Hot answers tagged

86

If you still have the previous versions available, you can just use brew switch python 3.6.5_1


84

A quick solution is to use homebrew to install python into /usr/local/bin so that your pip can run against a user-modifiable python framework. brew install python pip --version Disabling System Integrity Protection is also an option, but I don't recommend that for anything but professionally managed and fire walled servers where you have the manpower to ...


77

Another viable option without a need to disable SIP or install other Python versions, is to install the modules only for the current user using pip install --user <modulename> If it is just your personal machine, this would be the simplest and safest solution.


57

This problem often arises when pip tries to install a manpage for IPython on El Capitan. The quick fix is to use a pip command like this: sudo -H pip install --install-option '--install-data=/usr/local' <package> However, System Integrity Protection (SIP) on El Capitan blocks several bad practices with pip that used to slide by, so you will probably ...


53

If you don't have previous version to switch to, you can install from previous formula this way: $ brew unlink python $ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb Update 2019-10 --ignore-dependencies notice In case you're using --ignore-dependencies flag to overcome ...


49

$ brew install python3 is equals follow $ brew install https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb So. if you want to install a specific version then, you must check before install. Check the git history of python.rb Find the version you want. Now you can use brew install with the corresponding commit hash: 3.4.3_2: brew ...


48

Preferences are cached in 10.9. See http://hints.macworld.com/article.php?story=20130908042828630. If you edit a plist file directly or replace the plist of an application, the application will keep using the cached version even after you quit and reopen the application. You can run defaults read com.googlecode.iterm2 or killall cfprefsd to apply the ...


44

I personally use Homebrew, which is a very nice package manager. If you want to give this a try, first of all make sure you have the XCode Command Line Tools installed on your Mac. Then install Homebrew by typing ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" in the Terminal. Homebrew will place its "Cellar" (the ...


42

For python in mac use pyenv brew install pyenv pyenv install <version> To select a version pyenv local 3.5.0 To List versions pyenv versions https://gist.github.com/Bouke/11261620 You need to export the PATH to override the default python version. PATH="~/.pyenv/versions/2.7.10/bin:${PATH}"


37

I'm assuming the paths to the python script and its parameters are valid, otherwise you'd most likely be seeing errors in the Console instead. The last time I saw that error was because there were spurious characters in the plist, e.g. extra spaces, causing syntax errors and therefore making it fail to load. If you run plutil -lint on your plist, this will ...


35

So, I ended up removing all python installations, and reinstalling things via Homebrew. which python ---> /Library/Frameworks/Python.framework/Versions/2.7/bin/python Delete the entire Python.framework directory from /Library/Frameworks. which python3 ---> /usr/local/bin/python3 Delete the entire python3 directory. I was a bit nervous about the symlinks. ...


32

I solved this problem while writting question: For some reason /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/ folder (containing Xcode Command Line Tools) is here: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain To fix the problem: $ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/...


31

First, you're not disabling SIP as a way to address the issue. Sorry that's the reason that this folder creation is failing, but we have to work around it. Second, you lose all the niceties Apple thought they were giving you, like a bridge via pyObjC, when you install your own Python. (I'll admit, they say you should install your own to /usr/local if you're ...


21

All processes get paused when the system goes to sleep, independent of whether the process is part of macOS, an application or some code you wrote on your own. After the system wakes up again, all processes will continue to run.


20

Use Homebrew :) brew install python3 Hombrew installs everything into /usr/local/Cellar and creates symbolic links for applications in /usr/local/bin. It will not touch anything else in the system. It comes with the brew cleanup command, which removes unused or outdated applications automatically. To update it: brew update brew upgrade python3 It will ...


17

If you never want to see the crash report dialogs, there is a preference to disable them: defaults write com.apple.CrashReporter DialogType none Log out and back in to apply the changes.


17

/usr/bin is where most of the Terminal commands are stored (e.g. clear). When your brother deletes everything in /usr/bin, he basically deletes most of the executable files that the Terminal and the system use. So the only way to get them back is to reinstall the OS. To do that, boot into recovery mode by holding cmd+r during startup, then after it boots up, ...


14

Bash Since Bash is typically the default shell you can open up this file in your home directory: $ vim ~/.bash_profile And add your variable to this file: export ENV_VAR=12345 You can do this without even having to edit this file if you like, using the following one-liner: $ echo 'export ENV_VAR=12345' >> ~/.bash_profile And then confirm like so:...


14

Kinda. A clean installation of Catalina includes a /usr/bin/python3 binary, but it's a stub for installing the command line developer tools, which includes Python 3. If/when the command line developer tools are installed, the /usr/bin/python3 stub will run the actual python3 binary, but a clean install will just have the stub. The Python 2 binaries (/usr/...


12

If an application has open windows, this should raise them above windows from other applications, but keep them below ones from the current application. tell application "System Events" perform action "AXRaise" of window 1 of process "QuickTime Player" end tell


12

Having great trouble migrating iTerm2 (2.0.0) plist to my new Mac running Yosemite (10.10.1). What I did to fix that is: Open iTerm2, so a default com.googlecode.iterm2.plist file is created. Quit iTerm2 Deleted all cached preferences for iterm2 by issuing defaults delete com.googlecode.iterm2 Copied the file to the new Mac in the correct location inside ...


12

Figured it out. brew install libffi locate libffi.pc (in this case i also had to run the command to build the locate database, for which the code was included in the prompt from locate) returned /usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/libffi.pc Then within the virtualenv ran export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/ (...


11

You can also make the message appear as a notification instead: defaults write com.apple.CrashReporter UseUNC 1


11

I have done this sort of thing in two ways - however both do not coexist with homebrew although I suspect there should be a way similar to the macports one. The first is using Macports as the package manager. There are separate ports for several python versions 2.x and 3.x currently 2.4, 2.5, 2.6, 2.7 and 3.1, 3.2, 3.3 3.4 and 3.5. For example to install 3....


11

Two options To recover a previously installed Python version: brew switch python 3.x.x_x # Ex. 3.6.5_1 Use brew info python to see what you have previously installed To make a clean install of Python 3.6.5 use: brew unlink python # If you have installed (with brew) another version of python brew install --ignore-dependencies https://raw....


10

It's on 2.7.5. Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>


10

There appears to be an issue with recent Macports builds of python see this bug A workaround is to install pyXX-readline (py35-readline has been produced just for this bug) Another is to install python addding the +readline variant


9

You need to download the Command Line Tools for Mountain Lion. Xcode installed: Go to the prefences in Xcode (Xcode -> Preferences), select the 'Downloads' tab and choose to install Command Line Tools Xcode not installed: Apple has released a Command Line Tools package that is compatible with Mountain Lion (OS X 10.8.*), check the Apple Developers ...


8

Instead of using Finder aliases, use Terminal to create symbolic links (see man ln for details on usage): ln -s /path/to/python3.3/binary /usr/local/bin/python ln -s /path/to/python2.6/binary /usr/local/bin/python2.6 It's usually not a good idea to mess with /usr/bin content (will be wiped out with the next upgrade). Use /usr/local/bin instead and make ...


8

This question probably has all the answers for you. In short there is no easy way. Your options are: Recover the files from a (Time machin) Backup, if existent. Reinstall OSX, e.g. from the Recovery mode pressing Command+R at the startup screen Copy the missing files from the Recovery partition (check if the partition is up to date first). E.g. by doing ...


Only top voted, non community-wiki answers of a minimum length are eligible