Recently I got an ASUS Radeon RX 580 to replace an NVidia Card I was tired of fighting and trying to make work properly. As it turns out, no video card is very easy to get working with Hackintosh!

Anyway, today the problem was after finally getting two monitors working the secondary monitor was booting with a weird rotation and was a pain in the ass to change each time I logged in because the mouse was about 5″ off location on that screen.

There must be a way to automate it, thought I.

Here’s how I did it.

# cd ~/Documents/Source
# git clone https://github.com/CdLbB/fb-rotate.git
# cd fb-rotate
# gcc -w -o fb-rotate fb-rotate.c -framework IOKit -framework ApplicationServices
# nano /Users/YOURUSERNAME/Library/LaunchAgents/com.YOURCOMPUTERNAME.fb-rotate.plist

put this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>Label</key>
 <string>com.YOURUSERNAME.fb-rotate</string>
 <key>ProgramArguments</key>
 <array>
 <string>/Users/YOURUSERNAME/Documents/Source/rotate.sh</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
</dict>
</plist>

then get the list of your screens

/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -l

Which will output something like this

Display ID Resolution
 0xb430e32 1920x1080 [main display]
 0x2b287c4c 1200x1920

Take note of the screen you want to automatically rotate on boot. Copy the 0x00000 number.

# nano ~/Documents/Source/rotate.sh

And put fb-rotate command into the file

/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 0
/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 270

then make it executable

chmod +x ~/Documents/Source/rotate.sh

Now on your next reboot, it should auto flip your monitor the orientation you want. Obviously not a super elegant solution, but, whatever it’s done right, and, it works

If you want to test your scripts here they are testing:

to load:

launchctl load com.YOURUSERNAME.fb-rotate

to unload:

launchctl unload com.YOURUSERNAME.fb-rotate.plist

Comments

Comment by Edward Smith on 2018-09-05 20:46:52 -0500

Are these commands that you put into terminal?

… AND then a script is created?

How do you make it launch upon login?

Comment by Matt G on 2018-09-05 23:06:10 -0500

Hey Edward,

Yes, somewhat.

You open terminal, and then run these commands (changing where appropriate to your system — YOURUSERNAME and YOURCOMPUTERNAME and anything else noted like this).

You will have to create the scripts yourself.

It won’t hurt your system to just try what I’ve written and go through trial and error until it works 🙂

Comment by Johnny on 2018-11-26 13:57:19 -0500

Hey Matt,

thanks for this post. I had similar issues with a RX Vega 56 on Mojave. The autorotation after boot works flawlessly 🙂