I want to install different packages and software but I really don't like the idea of doing a sudo command to install anything.

I use Homebrew and MacPorts for getting any apps I need but is it possible to install applications, libraries and packages specific to a python style virtual environment and if I think I don't want these packages to collide, I can just delete a virtual environment or simply use a different environment?

Please let me know if the question does not make sense. Ever since I started using virtual environments in Python, I can't imagine not working with virtual environments and I was wondering if there is something equivalent or a pattern of installation that people recommend that would mimic that behavior?

ps> I know there is Fink also but I don't use it.

Version 2:
I think I need to verify my question further.
I already use virtualenvwrapper and do everything Python related in virtual environments. The question is independent of Python. Its just that virtualenv inspired me to see if there was an equivalent, user-account-wide.

What I figured would be awesome, came up when I was trying to install libjpeg, PIL, FreeType2, Pillow etc.
I wanted to install these libraries or packages like libjpeg, FreeType2 in a virtual environment of the OS. If I felt like the Homebrew version of these library installs was not to my satisfaction, I could just work in a different environment or try some other installation procedures and switch between environments of the installed applications.

So, I was wondering if something like that exists for OS X or are there some tricks one can do to emulate it?

  • I'm not sure I understand your question correctly, but why not use virtual machines? Have a look at VirtualBox in combination with Vagrant (vagrantup.com).
    – Gerry
    Aug 31, 2012 at 11:46

2 Answers 2


If you are dead set on that paradigm, then virtual machines seems to be a logical next step, no? Grab Virtualbox and do your thing in a VM.

Note however that package managers solve many problems virtualenv addresses. The libs you mention won't change interfaces radically, they are stable releases.

It's python libs which are the most volatile, not things like FreeType. I would just use whatever version X11 is using.


I'm not sure I understand what you are asking but, if you are asking about creating Python virtual environments using virtualenv, then you're there already. The advantage of using virtualenv is that it creates a self-contained Python instance within the virtual environment directory you create. When you use the python and pip commands within the virtualenv bin directory (which is what happens when you activate the virtualenv), any Python packages you install, whether it be with python setup.py or pip install or even easy_install are installed to a site-library directory within the virtual environment and have no effect on any other Python installations on your system. The virtual environment directory and its contents are subject to normal file system permissions so you can create it without the need to use sudo (say, if you create it somewhere within your home directory) and you can set file permissions to control whether any other users have access to the virtualenv. Unless you use the --no-site-packages option when creating the virtualenv, the virtualenv will have access to existing or new packages added to the base Python instance (the system Python or whichever other one you used to create the virtualenv, by default, the Python instance that virtualenv was originally installed in). But packages installed local to the virtual environment do not affect the original Python instance. If you used virtualenv --no-site-packages, no packages outside of the Python standard library will be "inherited" by the virtual environment.

You can use virtualenv in conjunction with third-party package managers like MacPorts, Homebrew, or Fink (they include virtualenv ports/recipes/packages) but within a virtual environment you will need to manage local Python packages yourself, presumably using the pip installed inside each virtual environment. virtualenv does not provide a mechanism for managing entities that are not packaged using Python standard distutils-style packaging, i.e. non-Python apps and C libraries.

You must log in to answer this question.