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

PHP/Python cross encryption

Hello,

for everyone looking for a possibility to encrypt/decrypt data between PHP and Python, here are a PHP class and a Python module which allow cross-encryption. Both languages create different encryption texts but the decryption is compatible using the ECB algorhythm using AES-128.

Requirements:

Python 2.7 + PyCrypto
PHP 5.4 + Mcrypt

PhPyEnc (656 downloads )