Enable TRIM on OSX 10.10 and 10.11

Now after releasing the newest apple operating system i had some problems with the TRIM command for SSDs. As many of you know, apple keeps their IOAHCI driver for themself so that no other company can write a kernel extension. And as a plus they integrated a kext signing mechanism into Yosemite which leads to the inability to load unsigned kernel extensions.

Here is what you have to do in order to enable TRIM. Open your terminal and enter:

# sudo su
# nvram boot-args=kext-dev-mode=1
# vim /Library/Preferences/SystemConfiguration/com.apple.Boot.plist

then change following lines

<dict>
        <key>Kernel Flags</key>
        <string></string>
​</dict>

to

<dict>
        <key>Kernel Flags</key>
        <string>kext-dev-mode=1</string>
</dict>

After that, reboot your machine. The above modifications disable kext-signing system-wide!!!

After the reboot open the terminal again and enter

# sudo su
# cd /System/Library/Extensions/IOAHCIFamily.kext
# cd Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS
# cp IOAHCIBlockStorage IOAHCIBlockStorage.backup
# perl -pi -e 's|\x00\x41\x50\x50\x4c\x45\x20\x53\x53\x44\x00|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|sg' IOAHCIBlockStorage
# touch /System/Library/Extensions/
# kextcache -prelinked-kernel /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache -K /System/Library/Kernels/kernel /System/Library/Extensions

then reboot again and everything should be fine again 😉

more infos here

UPDATE:

Starting with OSX 10.10.5 you have a built-in command to enable TRIM. Instead of manipulating the file IOAHCIBlockStorage, open the terminal and enter following command:

# sudo trimforce enable

Test SMTP AUTH using Telnet

Here is how to test SMTP authentication with telnet using terminal and openssl in Darwin or Linux:

  1. Get your user and password in base64 encoded strings (you need them in base64 because the server wants them to be like that)
    # echo 'myuser' | openssl base64
    # echo 'mypassword' | openssl base64
  2. Open a telnet conneciton susing port 25:
    # telnet myserver.domain.com 25
  3. Greet the server
    # EHLO myserver.domain.com
  4. Tell the server you want to authenticate
    # AUTH LOGIN
  5. The server now asks you in a base64 encoded string to enter user. Enter the encoded string you received for 'myuser' in point 1
  6. The server now asks you for the password, again in a base64 encoded string. Enter the encoded password received from point 1
  7. You should see a message now with authentication succeeded or authentication failed

Enable TRIM with Non-Apple SSD

DO NOT USE THIS ON OSX 10.10 (YOSEMITE)!!!

Apple enabled TRIM support with OSX Lion (10.7) but there is a catch: apple enabled it only on apple-chosen-SSDs. So if you upgraded your hard drive to a 3rd party manufacturer chances are big that TRIM isn't enabled. Here is how to enable it from commandline:

  1. open terminal
  2. make yourself root
    # sudo su
  3. then change into the needed directory and backup a file
    # cd /System/Library/Extensions/IOAHCIFamily.kext
    # cd Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS
    # cp IOAHCIBlockStorage IOAHCIBlockStorage.backup
  4. than patch the file for Mavericks 10.9.4-10.9.5
    # perl -pi -e 's|(^\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' IOAHCIBlockStorage
  5. OR for Mountain Lion 10.8.3 – Mavericks 10.9.3
    # perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' IOAHCIBlockStorage
  6. OR for Mountain Lion 10.8.1-10.8.2 and Lion 10.7.5
    # perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' IOAHCIBlockStorage
  7. OR for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW
    # perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' IOAHCIBlockStorage
  8. # touch /System/Library/Extensions/
  9. reboot your machine

In the system report (system information > serial-ata device) the TRIM support should list YES. The patch has to be re-applied everytime there's an OS update.