Why Homebrew didn't removed Python directory? - macos

I ran brew uninstall python but there's still the directory /usr/local/lib/python2.7.
Why brew didn't removed it? Is it still used? Can I remove it manually?

The folder /usr/local/lib/python2.7 is a directory shared with the system and it isn't owned by Homebrew: as you might now usr/local/Cellar is the proper Homebrew folder (along with several other spurious folders for taps and Cask).
It mainly contains packages (installed using pip).
I wouldn't touch such folder, since it is shared with the Python installation provided by OS X (through XCode Command Line Tools): if for any reasons (but I don't think so since you uninstalled python through Homebrew) you still have pip installed I would recommend to uninstall such packages through pip itself if you want to cleanup some space.

Related

How to Start Dropbox After Installing It with Homebrew Cask?

I just started using Homebrew and Cask today to install Unix and OS X applications on my Mac but I don't understand something about Cask. When I run this command,
brew cask install dropbox
I can see that it installs it in /opt/homebrew-cask/Caskroom/dropbox/latest/Dropbox.app and I can see that it has created a symlink ~/Applications/Dropbox.app that points to it, but when I look in Finder at my Applications folder, I don't see it there as I would if I had installed Dropbox from a .dmg file. Also, I don't know how to start Dropbox from this symlink. How do I get Cask to install OS X apps so that I can start them from either the Application folder or via the command line in a terminal session?
just run open ~/Applications/Dropbox.app from your cmd line.
See http://gillesfabio.github.io/homebrew-cask-homepage/ for overview.
Hope that helps
The behavior has changed over the last few months. If you update homebrew to version 1.0 and then run brew cask install dropbox, the application will now be physically moved into /Applications/, and the symlink will be created in ~/Applications/.

"Illegal instruction: 4" when trying to start Python with virtualenv in OS X

I've been using Python 2.7.10 in a virtualenv environment for a couple of months.
Yesterday, activating the environment went fine, but today suddently I get this cryptic error when trying to start Python from Terminal:
Illegal instruction: 4
I have made no changes to my environment (AFAIK), so I'm having a difficult time trying to come to terms with what this error is and what caused it.
Python works fine outside of this virtualenv environment. When running via /usr/local/bin it presents no problem.
I've had this problem a number of times now. While I can't say for certain what the actual issue is, I believe it basically means that some file(s) in the virtualenv installment of Python have become corrupted.
I keep my virtual environment in a synced Dropbox folder, so that may be a large contributor to the issue.
Restoring the virtual environment from a back-up archive worked for me. Or simply reinstall an identical virtual environment.
First, try activating the faulty environment by cd <path/to/old_env> and source /bin/activate.
If it's successfully activated, cd to an accessible location on the drive and run pip freeze > requirements.txt to export a list of currently installed Python modules.
Delete the old environment.
Install a new virtual environment of the latest version of Python 2 that you have on the computer, via virtualenv <path/new_env>
Or, if you want to use a specific Python version, first make sure you have you have it on your drive, and then do virtualenv -p <path>. Assuming that you have downloaded the Python version with Homebrew, e.g.: virtualenv -p /usr/local/bin/python2.6 <path/new_env>
Activate the virtual environment via cd <path/new_env> and then do source /bin/activate.
Assuming that you kept a list of modules to reinstall by previously doing pip freeze > requirements.txt, cd to the folder where the text file is located and do pip install -r requirements.txt.
Otherwise, reinstall the modules with pip manually.
I had same problem and found solution by uninstalling psycopg2 and installing older version. As I understood my comp was not supporting some commands in new version

How can I install pcre-light on OS X without root access?

I'm working on a shared system where I don't have root access, but where the admins have installed the Haskell Platform. Most Cabal packages install perfectly happily, but I need a library with a dependency on pcre-light, which of course depends on the C library pcre. Is there an easy way to install pcre under $HOME so that I can get on with my work?
As it happens, Homebrew works perfectly well from inside $HOME:
http://www.acloudtree.com/how-to-install-the-homebrew-package-management-utility-locally-on-mac-osx/
In short, you can install Homebrew simply by cloning the GitHub repo into $HOME, then adding $HOME/homebrew/bin to your $PATH. Then you can just say:
$ brew install pcre
Then tweak $HOME/.cabal/config like so:
extra-include-dirs: $HOME/homebrew/include
extra-lib-dirs: $HOME/homebrew/lib
(but use the actual directory instead of $HOME). Now cabal install pcre-light should work normally.

Existing config scripts when brew doctor is prompted

I'm completely new to Homebrew and Anaconda installation and I hope someone could help me out with the warning after executing brew doctor. I'm running on Snow Leopard 10.6.8. The warning is as follows:
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Users/user.name/anaconda/bin/freetype-config
/Users/user.name/anaconda/bin/libpng-config
/Users/user.name/anaconda/bin/libpng15-config
/Users/user.name/anaconda/bin/llvm-config
/Users/user.name/anaconda/bin/python-config
/Users/user.name/anaconda/bin/python2-config
/Users/user.name/anaconda/bin/python2.7-config
/Users/user.name/anaconda/bin/xml2-config
/Users/user.name/anaconda/bin/xslt-config
I executed brew --config and the following shows the configuration (hope it helps w/ the issue):
HOMEBREW_VERSION: 0.9.4
ORIGIN: (none)
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.6.8-i386
Xcode: 3.2.6
GCC-4.0: build 5494
GCC-4.2: build 5666
LLVM-GCC: build 2335
Clang: 1.7 build 77
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /Users/user.name/anaconda/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Really appreciate your help. Thank you.
tl;dr: you can't really fix this but you can probably ignore it
Those scripts ending in -config provide information for other packages that want to link to them during installation. Let's take libpng for example. If brew (or anything really) compiles a package that depends on libpng it might execute libpng-config to find out some details about the library.
The problem is that brew brings its own version of libpng so if both are installed brew might pick up the wrong libpng-config when installing additional software.
You can do one of four things now:
Ignore the warning if you're confident that the stuff you install with homebrew will not conflict with the stuff that comes with anaconda.
Edit your ~/.bash_profile and remove anaconda from the PATH. If you do this you will have to specify the full path every time you want to run anaconda python.
Move those anaconda config files aside (out of your PATH, e.g. into a config subdirectory). This will likely prevent additional software from linking to anaconda components but should be ok if you intend to keep anaconda isolated.
Remove anaconda completely (just delete the folder) and install brew's version of python. This will also give you pip which should make it easy to reinstall most of the other packages that come with anaconda.
i.e.
brew install python
Then to install e.g. numpy, simply:
pip install numpy
(To make brew's python your default add export PATH="/usr/local/bin:$PATH" to your ~/.bash_profile)
I believe I've found a reasonably safe way to deal with this (if you are using the fish shell).
Install Anaconda but don't add to PATH
Add a symlink to the conda binary somewhere on your PATH (in my case ~/bin)
mkdir ~/bin
cd ~/bin; ln -s ~/anaconda3/bin/conda .
Add section like follows to ~/.config/fish
set -gx PATH $PATH ~/bin
source ~/anaconda3/etc/fish/conf.d/conda.fish
Note that this activate's the conda shell configurationĀ for fish -- use conda activate some-env to switch into an anaconda environment rather than the bash-style source activate some-env. brew doctor should show that this issue no longer exists.
This setup lets you use the conda command to switch into conda-managed environments without worrying about leaky interactions between homebrew-managed python/dependency environments.
The one thing to remember is to avoid running homebrew when a conda environment is active as your path will be set for the conda environmnent and unsafe for homebrew usage.

Where is PyGTK for Mac OS X?

Is there a binary out there for the current mac os x, python for PyGTK? I work with multiple desktop environments (mac, windows, gnome) and really consider python's lack of cross platform GUI's a problem. Does anyone know where I can find a built version of PyGTK and GTK for Mac?
I cant clone the git repository, it keeps timing out.
brew install pygtk worked for me (requires homebrew).
Confirmed to work with OS X 10.10 too, but by default it will install it into brew's Python distribution, so if you are still using the native python, it will not find it.
I don't use macports but it seems that jhbuild works for me. Below is the steps that I've done.
download gtk-osx-build-setup.sh from: https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh and save it to your home directory.
fire up terminal and navigate to your home directory and run the command sh gtk-osx-build-setup.sh
the shell script will warn you that ~/.local/bin isn't added to your environment variable to do this, edit your .profile file located at your home directory and /Users/<username>/.local/bin to your environment variable. to know more on how to edit this file check out: http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
after that, do a ~/.local/bin/jhbuild bootstrap command. it will download and install some necessary utilities.
download and install the beta version of the gtk+ osx framework at: http://ftp.imendio.com/pub/imendio/gtk-osx/Gtk-Framework-2.14-LATEST.dmg
before installing the meta-gtk-osx-python, you need to build and install some other packages that jhbuild doesn't install automatically, so what i did was i installed libpng by doing the command: ~/.local/bin/jhbuild build libpng
you also need to install libtiff so do the command: ~/.local/bin/jhbuild build libtiff
and also gtk-doc is needed so: ~/.local/bin/jhbuild build gtk-doc
and finally you can now install meta-gtk-osx-python by doing a: ~/.local/bin/jhbuild build meta-gtk-osx-python
Let me know if it works.
There is an installer for PyGTK 2.24 in test here, announced on the PyGTK list.
UPDATE project has moved on macpkg's sourceforge page.
I couldn't make it work with meld (segmentation fault), but sample PyGTK programs work OK.
UPDATE 2 since then a new package Py3GTK3 appeared on the same sourceforge page. Haven't tested though.
There is now a mac package on sourceforge
Download the latest package from http://sourceforge.net/projects/macpkg/files/PyGTK/ and install.
If you're just trying to use the system python, this is all you'll have to do.
If you're not, the following is how to install it with pyenv, which can be installed with Homebrew. With brew installed, you can install version pyenv and Python 2.7.8 with:
brew install pyenv && pyenv install 2.7.8
After you've done that, you'll then have copy the gtk package and its dependencies into your python installation:
cd /opt/gtk/lib/python2.7/site-packages/ && \
cp * ~/.pyenv/versions/2.7.8/lib/python2.7/site-packages/
That's it. You can also similarly install the Py3GTK3 package which has packages for python 2.7 and 3.2 from http://sourceforge.net/projects/macpkg/files/Py3GTK3/.
Have you tried doing it using macports? This website shows how.

Resources