Knowledge: Getting Your Hands Dirty with Terminal
- Knowledge: Getting Familiar With Kexts and Your Hackintosh
- Knowledge: Getting Your Hands Dirty with Terminal
- Knowledge: Tips and Extra Commands to Manage your Hackintosh
Lets get some work done
Before we get to the particulars, a few things. The commands you are about to see require you to execute them with “Super User” privileges. On unix and unix derived systems like Mac OS X the super user is known as the root user. As root you can do what you want disregarding permissions. You need to be careful. The difference between these two commands may appear subtle (it’s only a space), but one will remove a single folder, the other will try to remove every file on your system.
‘sudo rm -rf /Users/Me/Myfiles/’ is OK and will remove only the folder ‘Myfiles’ in the home directory of the user ‘Me’.
‘sudo rm -rf /Users/Me/Myfiles /’ is NOT OK. It will remove the folder ‘Myfiles’ and then start removing files, recursively, from the ‘/’ (root) directory. This is not a good thing!
If you want to get more information about any of these commands, or any shell command, you can use ‘man’ (short for manual).
‘man ls’ will tell you everything and more you ever wanted to know about the ‘ls’ command (short for list).
This guide and others may contain typos. For that reason you should hesitate to copy and paste commands into the terminal. Take the time to type the command, think about what your trying to do, and if your not sure of the exact syntax have a look at the man page first. Always have a second look BEFORE pressing enter.
Getting an extension bundle ready to go
Extensions bundles need to be owned by root and have specific permissions set before they can be tested or installed. The commands ‘chown’ (change owner) and ‘chmod’ (change mode) will get the job done.
For an extension bundle called SomeExtension.kext in folder ‘/Users/Me/Hackintosh’, prepare the extension with the following:
‘sudo chown -R root:wheel /Users/Me/Hackintosh/SomeExtension.kext’
Sets the owner of SomeExtension.kext and all the files inside (‘-R’ is for recursive) to root and a member of the wheel (superusers) group.
‘sudo chmod -R 755 /Users/Me/Hackintosh/SomeExtension.kext’
Sets the permissions (file access mode, hence the command name) to read, write, and execute for the owner, read and execute for wheel group members, and read and execute for everyone else.
Backup an installed extension bundle
Always make a backup of any extension bundle you are going to replace. This is especially true for the original Apple extensions. You never know when you are going are going to need to fall back on an older version or replace the original Apple extension due to a plist only extension becoming available.
If your not sure if there is an existing extension installed, you can use the finder to look in all of the locations you might find extensions (remember the three locations talked about earlier), if you sort by name it’s easier to see what’s there.
To backup bundle SomeExtension.kext from ‘/System/Library/Extensions’ into the backup folder ‘/Users/Me/Hackintosh/Backups’
‘sudo cp -R /System/Library/Extensions/SomeExtension.kext /Users/Me/Hackintosh/Backup’
The ‘-R’ is for recursive and mandatory.
Install an Extension
To install the extension bundle SomeExtension.kext residing in ‘/Users/Me/Hackintosh’ to ‘/System/Library/Extensions’
If the extension already exists and you have backed it up, remove the original
‘sudo rm -Rf /System/Library/Extensions/SomeExtension.kext’
Then install with
‘sudo cp -R /Users/Me/Hackintosh/SomeExtension.kext /System/Library/Extensions’
Removing an Extension
To get rid of a problem child
‘sudo rm -Rf /System/Library/Extensions/SomeExtension.kext’
The Extension.mkext archive
The system extension archive should rebuild itself with no action on your part. If your the belt and suspenders type, you can force the issue with
‘sudo touch /System/Library/Extensions’
And if your really obsessive
‘sudo rm /System/Library/Extensions.mkext’
If you then reboot before the system is done rebuilding or updating the archive you will see a dialog notifying you that the cache is being rebuilt and your reboot will be delayed until it’s done, click OK. If you don’t see the dialog, it just indicates that the archive has been rebuilt or updated already, don’t worry.
For extensions in the ‘/Extra/Extensions’ folder we’re on our own. The system is no help building an archive for these extensions. This archive is optional, but it is considered good form to create one. If you do create a ‘Extra/Extensions.mkext’ archive, you have to rebuild it every time you add or remove extensions from the ‘Extra/Extensions’ folder.
‘sudo kextcache -m /Extra/Extensions.mkext /Extra/Extensions’
The boot cache
The boot cache shouldn’t be a problem under most circumstances. But experience show’s that often, for reasons unknown, the system just doesn’t get the message and realize the cache is out of date. To fix this, anytime you fiddle with your extensions you can reboot with the ‘-f’ flag, which will cause the cache to be ignored and then rebuilt.
You can also delete the cache with
‘sudo rm /System/Library/Caches/com.apple.kernelcaches/*’
And then just reboot as normal.
Other guides have suggested removing everything in the ‘/System/Library/Caches’ folder on occasion. While this doesn’t hurt anything, you are removing caches other than the boot cache and it’s just not good style to blindly whack system files.
What Terminal commands to view your hard drive