Upgrading Mac - OSX El Capitan

Upgrading Mac from Mavericks to El Capitan

Here’s a quick runthrough of some of the issues you will encounter (and their fixes), upgrading a developer Macbook from OSX Mavericks to El Capitan. This is a recap of my upgrade experience. Though a lot of small corrections were required, upgrading Mac generally went smoothly.

For developers, every new Mac OS upgrade means inevitable breakage of some part of your local development stack. There is good reason to be wary of hastily applying every upgrade. Sometimes it’s worth skipping an upgrade altogether, or at a minimum waiting a few months after a release to let any significant problems get patched or Stack Overflow-ed. Many apps will need compatibility updates that can take months to become available after the core OS is updated.

My dev Macbook is running:

  • a local Apache webserver
  • Django/python apps
  • Mysql
  • WordPress/PHP
  • Jetbrains Pycharm & PhpStorm IDEs

Here is the list of problems I encountered and how to solve them, including Pycharm errors, Apache errors, Django errors, and more.

Pycharm-specific errors after upgrading Mac

1. Pycharm and PHPStorm will not start to due an error about obsolete Java version 1.6.

Solution:
– Open Finder
– Click Applications
– In the right pane, right-click on PyCharm or PHPStorm, click Show Package Contents
– Open Contents folder
– Open the Info.plist file in a text editor
– Find the JVMVersion and change the value as shown below. Then save the file and reopen Pycharm/PHPStorm.

Old:

<key>JVMVersion</key>
<string>1.6*</string>

New:

<key>JVMVersion</key> 
<string>1.6+</string>
(Update JUST the 1.6 to replace * with +, if you see a varation like <string>1.6*, 1.7+</string>)

Fix thanks to http://exponential.io/blog/2015/02/10/install-pycharm-on-ubuntu-mac-os-x/

2. Git integration in Pycharm no longer works

Pycharm status bar shows:
Can’t start Git: /usr/bin/git // Probably the path to Git executable is not valid. Fix it.

Solution:
– Open Pycharm Preferences > Version Control > Git
– Verify your git executable path is correct (if you type “which git” in Terminal, it matches IDE)
– Click “Test” button in Pycharm
– If Popup error says:
Error running Git
Errors while executing git —version, exitCode=69
errors:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo

– Use Spotlight to find & open “Xcode”
– Accept agreement

There was a new Xcode update in App Store for El Capitan.

Django startup errors after upgrading Mac

1. Upgrading Mavericks to El Capitan deletes custom logs and log folders under /var/log/

Django app would not start because it could not open the required log files (which I store under /var/log/django and which the upgrade had deleted). These loggers are set up in my Django settings.py file. One such error:

ValueError: Unable to configure handler 'emails': [Errno 2] No such file or directory: '/var/log/django/emails.log'

Solution:
– Recreate any custom log folders & set owner permissions to your typical log user (skip chown if you don’t normally have different log user):

sudo mkdir /var/log/django
sudo chown myuser /var/log/django

There’s no recovering the lost logs unless you made your own backup.

2. Mysql error in Django

The next Django startup error was a Mysql issue:

File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 17, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/_mysql.so
Reason: unsafe use of relative rpath libmysqlclient.18.dylib in /Library/Python/2.7/site-packages/_mysql.so with restricted binary

Solution:
– Open Terminal
– Run this command

mdfind libmysqlclient.18.dylib

– Copy resulting path to .dylib file, then paste into this command and execute:

sudo install_name_tool -change libmysqlclient.18.dylib \
/usr/local/mysql-5.6.24-osx10.8-x86_64/lib/libmysqlclient.18.dylib \
/Library/Python/2.7/site-packages/_mysql.so

Fix from: http://stackoverflow.com/questions/31343299/mysql-improperly-configured-reason-unsafe-use-of-relative-path

Apache startup and runtime issues after upgrading Mac

Turns out the El Capitan upgrade also upgraded the native apache from 2.2x to 2.4x, which caused numerous compatibility issues with my custom development config file.

1. Apache will not start due to configuration syntax changes

Apache logs had no information. The “Console” app showed me that httpd was not successfully starting.

I ran `httpd -v` and saw this error:

AH00526: Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf:
Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration

Solution:
– Comment out this entire offending block:

#<IfModule !mpm_winnt_module>
#<IfModule !mpm_netware_module>
#  LockFile "/private/var/log/apache2/accept.lock"
#</IfModule>
#</IfModule>

I then ran `apachectl -t` & got a new errror:

AH00526: Syntax error on line 3 of /private/etc/apache2/other/valsites.mac.conf:
Either all Options must start with + or -, or no Option may.

Solution:
– Add the explicit + prefix to all instances of Options in my custom Apache config

Old:

Options Indexes FollowSymLinks

New:

Options +Indexes +FollowSymLinks

2. Some modules are disabled by default after the Mac upgrade

With the Mac Apache upgrade, one missing module showed up as a config error (in response to running `apachectl -t`):

AH00526: Syntax error on line 143 of /private/etc/apache2/other/valsites.mac.conf:
Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration

Solution:
– Uncomment the line below in /etc/apache2/httpd.conf, then restart apache:

LoadModule expires_module libexec/apache2/mod_expires.so

At this point, my Apache was able to start (`sudo apachectl restart`), but there were still runtime issues to fix.

3. A missing module breaks Wordpress: PHP pages are rendered as plain text

If WordPress simply does not work and you see text from the PHP file in your browser…

Solution:
– Uncomment the line below in /etc/apache2/httpd.conf, then restart apache:

LoadModule php5_module libexec/apache2/libphp5.so

4. A missing module breaks WordPress permalinks

If your local permalinks within WordPress now give you a 404, here’s the fix.

Solution:
– Uncomment the line below in /etc/apache2/httpd.conf, then restart apache:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Fixes inspired by: http://apple.stackexchange.com/questions/211015/el-capitan-apache-error-message-ah00526 and http://serverfault.com/questions/647665/either-all-options-must-start-with-or-or-no-option-may

5. Apache static files return Forbidden error

Apache normally serves my local static files, but after upgrade they return this status 403 error in the browser:
Forbidden
You don't have permission to access /static/inc/bs3.3.1/css/bootstrap.min.css on this server.

Solution:
– Replace uses of Order and Allow in my config, such as:

       Order allow,deny
       allow from all

– with the new:

       Require all granted

Fix via: http://stackoverflow.com/questions/21551840/forbidden-you-dont-have-permission-to-access-on-this-server

Audio broken – No working sound from my laptop speakers

Solution:
– Open Sound app (search or go Apple menu -> System Preferences-> Sound
– Click Output
– Select Internal Speakers/Built-in

Fix from http://www.iphonetopics.com/fix-sound-not-working-issue-mac-os-x-el-capitan/

Spotify login with Facebook broken

I’ve had (and fixed) the same problem recently on my PC. However, the PC fix did not work for my Mac.
The browser shows error:
Spotify desktop client communication failed.

Quick Solution:
– Login with your Facebook email/password in the plain fields – WITHOUT connecting through facebook

NOTE: The fix for my PC which did not work for my Mac was to add the following to hosts file:
127.0.0.1 login.spotilocal.com

Mysql does not autostart when machine reboots after upgrading Mac

If after reboot, mysql does not automatically restart, so you are unable to connect to your database and any apps dependent on the database throw errors…

Solution:
– Create the file /Library/LaunchDaemons/com.mysql.mysql.plist, and populate it with the following (verify the path to your msyqld_safe executable matches):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
<string>--user=mysql</string>
</array>
</dict>
</plist>

– Restart machine, then verify mysqld and mysql_safe processes are running by executing in Terminal:

ps -e|grep mysql

Fix thanks to: http://stackoverflow.com/questions/26461173/autostart-mysql-server-on-mac-os-x-yosemite-el-capitan

External Seagate USB drives have become read-only file systems

I use external USB drives for backup, but they now are unwriteable due to errors such as:
rsync: failed to set permissions on "/Volumes/Seagate Backup Plus Drive 2TB/blah/somefile.js": Read-only file system (30)

Solution:
– Download the updated Seagate driver software (called Paragon) from here: http://www.seagate.com/in/en/support/external-hard-drives/desktop-hard-drives/backup-plus-desk/ntfs-driver-for-mac-os-master-dl/

Fix thanks to: https://discussions.apple.com/message/29061326#29061326


That’s it. All quick fixes upgrading Mac to El Capitan.

Valerie Lanard

I am a fitness buff, engineering leader, and wearables lover. This blog originally started as part of my now-defunct fitness video startup, Gigabody. It has evolved to encompass my writing on tech and work culture as well. Find me on a bike, on a hike, in a skort, or near a usb port.

Leave a Reply

Your email address will not be published. Required fields are marked *