Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
When I upgraded my Mac to OS X Mavericks, a lot of utilities (like Python, virtualenv, Xcode) broke, and it was pretty stressful trying to get it all set back up. Hopefully this guide can spare you some of that pain.Note: I'm by no means a Linux or Mac expert, so please fork and let me know if anything is redundant, incorrect, or missing!
# A guide to prevent pain and suffering while upgrading to OS X Mavericks
# This will vary greatly depending on system set up, so read the instructions carefully
# Back up Virtulenvs
####################
# Very important!
# For each virtualenv you have, run "pip freeze > requirements.txt" while in the activated virtualenv
# in order to prevent loss of dependencies during the upgrade.
# Install Mavericks
###################
# Go to the App Store and install Mavericks
# Takes about 15 - 20 mins including set up
# Test Configuration
####################
# See if anything broke during the upgrade - I obviously had errors here.
$ cd project/using/virtualenv
$ workon <myproject>
$ python <myproject.py>
# If everything works, you're good! Otherwise, continue...
# Reinstall Virtualenv
######################
$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command
$ python easy_install.py virtualenv
# Reinstall Xcode Command Line Tools
##################################
# Yes, for some reason Mavericks uninstalls command line tools...
# Make sure you get the latest version (5.0.1)
$ xcode-select --install
# Repair Homebrew
#################
# If you don't already have Homebrew, I highly recommend that you install it now (http://brew.sh/)
# It will make fixing Python much easier if you need to relink it
$ brew update
$ brew upgrade
$ brew doctor
# Reinstall Python (if necessary)
#################################
# Try python from the command line. If it works, congratulations!
# Depending on your system set up, you may need to reinstall using Homebrew.
$ brew install python # if you have an error, it's already installed and there's no issue
$ brew unlink python
$ brew link --overwrite python
# Then, if you want to include Python 3 as well (recommended):
$ brew install python3 # same deal here
$ brew unlink python3
$ brew link --overwrite python3
# Reinstall virtualenv{,wrapper}
################################
$ sudo pip install virtualenv
$ sudo pip install virtualenvwrapper
# Reinstall requirements
########################
# You might need to reinstall pip requirements (usually not, but if you have any issues, do this):
$ cd path/to/project
$ mkvirtualenv <project>
$ pip install -r requirements.txt # you backed them up didn't you?
# Finish
########
# I hope this guide was helpful!
# Please fork if you have any suggestions, or shoot me an email at jhghank@gmail.com.
@andreimarcu

This comment has been minimized.

Copy link

commented Oct 25, 2013

Line 31 I think you mean command, not comman

@goldsmith

This comment has been minimized.

Copy link
Owner Author

commented Oct 26, 2013

Fixed, thanks!

@chrisdl

This comment has been minimized.

Copy link

commented Oct 27, 2013

lifesaver!

@briancline

This comment has been minimized.

Copy link

commented Oct 27, 2013

This fixed a slew of Python problems in Mavericks that I didn't even know I had yet. Thanks!

@garrettwilkin

This comment has been minimized.

Copy link

commented Oct 29, 2013

I had to uninstall virtualenv & virtualenvwrapper like this:

sudo pip uninstall virtualenv sudo pip uninstall virtualenvwrapper

as well. I think that's because I attempted to re-install them before finding this set of instructions, so I was missing the step to reinstall command-line tools from XCode, and the brew steps.

THANK YOU! My local python dev environment is working again!

@dcsan

This comment has been minimized.

Copy link

commented Oct 30, 2013

also:

brew install --no-tcl postgresql
@goldsmith

This comment has been minimized.

Copy link
Owner Author

commented Nov 1, 2013

I also had postgresql issues, but I had to fix them without Homebrew. What does the --no-tcl flag do?

@luckyjajj

This comment has been minimized.

Copy link

commented Dec 28, 2013

Excellent !!

@maxfenton

This comment has been minimized.

Copy link

commented Jan 15, 2014

If xcode-select --install gives you an error about Software Update, you can get the xcode command line tools from https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-

@michalbachowski

This comment has been minimized.

Copy link

commented Feb 3, 2014

Excellent tutorial! Two additional steps from me:

  • if brew complains that XCode license has to be aggreeded - run XCode in graphical mode
  • if brew complains about re-linking libraries - check permisions to /usr/local/bin directory (I needed to fix it: sudo chmod g+w /usr/local/bin/)
@kneufeld

This comment has been minimized.

Copy link

commented Apr 19, 2014

I fixed all my (obvious) problems just by relinking everything.

for l in `brew list`; do brew unlink $l; brew link --overwrite $l; done
@hubbubca

This comment has been minimized.

Copy link

commented Jul 3, 2014

THANK YOU! To both goldsmith and kneufeld. I installed Maverick over night, and woke up to broken development environments. This was followed by remembering I have some stuff that needs to be production ready in a couple of ours. Followed by a panic attack, and then peace after finding your helpful guide.

Cheers,
PJ

@torstenwerner

This comment has been minimized.

Copy link

commented Oct 2, 2014

Isn't --overwrite too dangerous to be used on every keg?

@adamdharris

This comment has been minimized.

Copy link

commented Feb 8, 2016

Thank you @goldsmith and @kneufeld. Fixed a number of issues for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.