

Installing and setting up OS X Mavericks for Python development - alesdotio
http://blog.kristian.io/django/2013/10/23/setting-up-os-x-mavericks-for-python-development.html?hn

======
Osmium
This article is so opinionated. Just some counter-options:

 _Enabling apps from everywhere_ : Don't disable this. It's actually a good
security feature. If you want to run an app that isn't signed, right-click and
click "Open" and confirm you really want to run it and the OS will remember
that choice for that app in future.

 _Terminal_ : The default Terminal is actually pretty solid. Much better than
it used to be. Two common complaints (lack of tabs, lack of colours) are now
moot.

 _Oh My ZSH_ : Or you could use _fish_ – a new Mavericks compatible build
(2.1) should be coming to the homebrew package manager literally any time now.

Also, for Python specifically (i.e. the title of this post), you can install a
new version of Python via homebrew (and then place /usr/local/bin above
/usr/bin in your PATH). This has the advantage of being able to run pip
without superuser privileges. Though if you're using virtualenvs, it's
probably not that big a deal anyway.

~~~
jamesjporter
+1 for installing python from homebrew; letting the default OSX installation
be used at all has caused me mad problems in the past.

------
ra
Be wary of using case sensitive FS. Many apps simply don't work on case
sensitive.

Maybe they've fixed it, but not long ago the whole Adobe suite just wouldn't
work on case sensitive EXT FS.

You should use a convention for your filenames anyway. Eg in Python you always
use lower case.

~~~
oellegaard
The major reason behind the switch is that I recently had to rename a file,
that someone accidentally comitted with an uppercase letter. We had to do it
on another machine. It's a valid concern though.

~~~
danieldk
At my previous employer, where most developers use Linux, there was a README
and a readme with different content in the same directory in a git repository.
Loads of fun on case-insensitive OS X, since git always believed some data was
removed ;).

~~~
levosmetalo
The way you phrased it one could assume that it's somehow git's fault ;)

------
privong
From the post: "Homebrew helps you compile different kinds of software on your
mac, making it feel _almost as easy as apt-get 'ing a package on e.g.
ubuntu._" (emphasis added)

This is something I've noticed from using both OSX and Linux for the past few
years — unless software is available as a drop-and-install package, it's
universally _easier_ to install in Linux* than it is in OSX. Given the market
for OSX and the amount of development that happens on it, I'm surprised the
situation isn't better (for OSX), but perhaps that just speaks to the work
people have done on package managers for the various linux distributions.

* - Holds true, in my experience, for Ubuntu and Arch. Likely the same for other distros..

~~~
antimagic
Yes and no. Having done professional and personal development for OS X and two
linux distributions (Fedora / Gentoo) it is most definately easier on Linux if
you want to just hack together some software for your own use. As soon as you
want to distribute that software however, the advantage often disappears - you
can't use the package manager version of a lib because you need a feature in a
later version, or because you need a different option activated during
compile. Or you have a patch for said library that was refused upstream.

If anything like this happens in a dependency of your module, you're probably
going to have to recompile all of the downstream dependencies by hand, or risk
breaking your development system.

To avoid all of this you end up compiling static versions of the libs from
your dependencies, and linking them statically to your module. This is
particularly true if you don't want to be at the mercy of upgrades to those
dependencies in your distribution that break your code.

Looking at things from the other side, there have been various package
managers for OS X that give some of the ease-of-development available thanks
to yum or apt-get. At the moment homebrew seems to be getting quite a bit of
traction, and has addressed many of the pain points that predecessors such as
MacPorts and fink have had, making OS X decidely more linux-like when you're
writing the software without plans for distribution.

~~~
tehwalrus
I'm a long-time macports user, and brew just blew me away with how much less
work it made me do! (even just in terms of other source builds finding
libraries by themselves - a real boon.)

~~~
Osmium
I'd really like to use both macports and homebrew, and switch between them as
necessary, but I don't know a good way of doing this. I know homebrew is
relatively well-behaved and doesn't really put stuff outside /usr/local, but
other things install into /usr/local too so I can't just remove that from my
PATH when I want to use macports.

If anyone knows a reliable and simple way to do this I'd be very grateful.

~~~
tehwalrus
I'm not sure to what extent this works with brew, but you could try using
virtualenv to manage different environments?

I've never had to deal with multiple configurations on the same mac (my
solution, off hand, would be to use debian VMs, possibly through SSH rather
than a desktop GUI if I needed >1 at a time.)

~~~
Osmium
Yeah, I'm thinking about going down the VM route with Ubuntu Server inside
Parallels. Seems a bit of a waste of computing resources though.

~~~
tehwalrus
virtualbox is free! And fine for the purposes of running scientific software.

EDIT: and in terms of resource usage, RAM is cheaper than headaches.

------
rb2k_
I wouldn't do the "Enabling apps from everywhere" step. If you have an
unsigned app, just right click on it and select open. OSX will ask you once
and be fine with it from then on.

~~~
maaku
If you develop your own applications, that can get very annoying very fast...

~~~
archgrove
It never asks for locally created applications. It's _purely_ for things
downloaded over the Internet. In essence, it's a more advanced version of the
original "You just downloaded this, are you sure you want to run it" warnings
from the file quarantine system introduced with....Leopard, I think?

~~~
danieldk
Yep, its asks it for files with the 'com.apple.quarantine' flag, which is
attached to downloaded files.

You can see its value with:

    
    
      xattr -p com.apple.quarantine <filename>
    

And remove it with:

    
    
      xattr -d com.apple.quarantine <filename>
    
    

Binaries/application bundles that roll out of your linker/xcodebuild do not
have that attribute. Hence, no bugging :).

------
driggs
Always install an upstream Python in parallel to the OS X provided version if
you're doing Python development. Apple custom compiles theirs, and it's always
out of date. In fact, there are Mavericks specific bugs in both latest
upstream and in the version included with Mavericks; look for a new Python
release in the next few days.

See: [http://code.activestate.com/lists/python-
dev/125760/](http://code.activestate.com/lists/python-dev/125760/)

And don't forget to `brew install python`!

------
aldanor
Before Mavericks, I was stupid (and lazy) enough to use the system Python, so
my site-packages folder was completely destroyed on OS upgrade and instead of
restoring a backup I decided to finally switch to home-brewed 2.7.5.

Installing numpy/scipy/matplotlib can be pretty tricky because of non-standard
homebrew library locations (for stuff like gtk+, freetype2 etc), so you're
better off using this [http://github.com/samueljohn/homebrew-
python](http://github.com/samueljohn/homebrew-python) and
[http://github.com/Homebrew/homebrew-
science](http://github.com/Homebrew/homebrew-science) for all your scientific
needs. By the way, Qt, Numba and a couple of other libraries seemed to get
broken (upstream) in Mavericks, but I guess that wouldn't take too long to
fix.

Also, upgrading homebrew libraries on Mavericks requires reinstallation of the
entire dependency tree (because newest clang uses the newer libc++ instead of
libstdc++).

------
HugoDias
I dont code in Phyton, but i think that you should add xcode commands line
tools in this tutorial. [http://www.computersnyou.com/2025/2013/06/install-
command-li...](http://www.computersnyou.com/2025/2013/06/install-command-line-
tools-in-osx-10-9-mavericks-how-to/)

~~~
taude
I think Homebrew requires this? Or at least some of the basic packages I
installed with it did....

~~~
nwh
Homebrew certainly requires the Xcode tools.

------
Walkman
Instead of installing PostgreSQL with homebrew, I suggest
[http://postgresapp.com/](http://postgresapp.com/), "the easiest way to run
PostgreSQL on the Mac"

------
forgotAgain
I've also decided to do a clean install of Mavericks on my mini. This time I'm
going to try to limit the number of different ways I use to install software.
Each standard way of installing seems to handle things differently. Over time
the system becomes unknowable and a clean install is needed.

------
teilo
On a clean installation of Mavericks, you should install the latest version of
setuptools before you install anything else, as setuptools 0.6 is very broken:

    
    
      wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python

~~~
SnowLprd
Homebrewed Python includes the latest versions of pip and setuptools, making
the command you suggested only necessary if you plan on sticking with the
bundled system Python (which isn't recommended for reasons discussed in other
comments here).

------
adamors
Why are people still using powerline when there's a pure Vimscript
implementation? [https://github.com/bling/vim-
airline](https://github.com/bling/vim-airline)

~~~
vivab0rg
Or even better, lightline?
[https://github.com/itchyny/lightline.vim](https://github.com/itchyny/lightline.vim)

~~~
recuter
Why is it even better?

~~~
quarterto

      Why yet another clone of powerline?
        vim-airline is a nice plugin, but it uses too much functions of other plugins, which should be done by users in .vimrc.

~~~
recuter
So it isn't strictly better just more standalone. I happen to use the other
plugins already so I don't mind the dependency.

But I will try airline out. :)

------
kayoone
just use a vm (eg vagrant) or a remote server and be platform independent!

~~~
workhere-io
Why use extra RAM on Vagrant when your Mac OS X is a full-featured Unix OS?
Don't get me wrong, I know that the more complicated your setup gets, the more
it would make sense to use Vagrant - but if you're just developing a CRUD
Flask / Django app with PostgreSQL, you might as well just install
Postgres.app and develop locally.

~~~
taude
I had tons of issues trying to get Postgres to work on my Mac. Lots of other
conflicts, too. I think the Mountain Lion OS upgrade fried my host dev
environment, too. Eventually, I went the VM route....afterall, you're going to
eventually deploy to a Linux box anyway, and there's enough differences that
you'll feel the pain when you go to deploy.

And now, I don't have a polluted host OS with tons of versions of software. I
can easily try out new technologies, kill the VM, and start over.

Keeping VMs for different projects in their on silo'd around is really
convenient.

Switching OSes or upgrading, rebuilding a computer, etc. I don't loose these
configurations.

The list goes on and one.

RAM is cheap. I think I paid $100 to upgrade my Mac Book Pro to 16 GB.

I can also switch back to a host Windows machine and take my VMs with me
(should the need arise)

~~~
workhere-io
_I had tons of issues trying to get Postgres to work on my Mac_

Did you try [http://postgresapp.com](http://postgresapp.com) ?

~~~
taude
Yes, I actually have that installed. Back when I was originally trying to get
it to work, that wasn't available.

------
bigd
another neat trick: \- install brew cask [https://github.com/phinze/homebrew-
cask](https://github.com/phinze/homebrew-cask) to have homebrew manage other
apps: chrome, alfred ..

Sadly it seems that many python packages have big issues with overloaded =,
which means that brew can't compile many tools I need. so If you need anything
relying on boost you might want to delay the update

