mac-setup
mac-setup copied to clipboard
A macOS development environment setup guide and installation scripts.
macOS Development Setup
A macOS development environment setup guide and command-line tool.
Command Line Tools (mandatory)
The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS.
If you are upgrading
-
Remove old version of the Command Line Tools:
sudo rm -rf /Library/Developer/CommandLineTools
Install Command Line Tools
-
Paste that in the terminal prompt:
xcode-select --install
-
A software update popup window will appear. Click
Install
, then agree to the Terms of Service when requested. -
The Command Line Tools is installed at:
/Library/Developer/CommandLineTools/
Xcode (optional)
Xcode is Apple's integrated development environment (IDE) for Swift, Objective-C, C, and C++. It also supports Java, AppleScript, Python, Ruby, and ResEdit (Rez).
Install Xcode
Download and install Xcode from the App Store or from Apple's website
:warning: Xcode takes over 13 GB of disk space! Its installation is optional.
Homebrew (mandatory)
Homebrew is the missing package manager for macOS.
Install Homebrew
Open the terminal and run the following script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Or upgrade Homebrew
-
First update the formulae and Homebrew itself:
brew update
-
You can find out what is outdated with:
brew outdated
-
Upgrade a specific formula with:
brew upgrade <formula>
-
Or upgrade everything with:
brew upgrade
Git (mandatory)
Git is a free and open source distributed version control system.
Install and set up git
-
Paste that in the terminal prompt:
bash <(curl -fsSL raw.githubusercontent.com/borgesnotes/mac-setup/master/install) git
-
Or follow the Git set-up guide.
Terminal
Apple switched to using Zsh as the default shell since October 2019. However, you can quickly switch back to Bash if you prefer.
Check out how to select your shell and set up your terminal theme:
- Bash tutorial
- Zsh tutorial
Python
Python is a programming language that lets you work quickly and integrate systems more effectively.
Install Pyenv and Python 3.10.7
Pyenv lets you easily switch between multiple versions of Python.
-
Paste that in the terminal prompt:
bash <(curl -fsSL raw.githubusercontent.com/borgesnotes/mac-setup/master/install) python310
-
Or follow the Python set-up guide.
:warning: It is recommended to close and reopen the terminal to apply the configuration!
Python for Data Science
Python Packages
- TensorFlow, Keras, numpy, pandas
- scipy, scikit-learn, scikit-image, sk-video
- Matplotlib, pillow
- Jupyter lab & extensions
Install Python Data Science packages
-
Paste that in the terminal prompt:
bash <(curl -fsSL raw.githubusercontent.com/borgesnotes/mac-setup/master/install) pypackages
-
Or follow the Python Data Science set-up guide.
Visual Studio Code - VS Code
Visual Studio Code is a lightweight but powerful source code editor.
Check out the VS Code set-up guide.
Using VS Code with particular technologies
Microsoft created a collection of recipes for using VS Code with particular technologies (mostly Web).
Make sure to visit it at Microsoft/vscode-recipes.
LaTeX - MacTeX (optional)
MacTeX is an install package which installs everything needed to run TeX on Mac OS X.
Uninstall old version
It is easy to remove most software installed by MacTeX:
# Remove MacTeX 202X
sudo rm -rf /usr/local/texlive/202X
Install LaTeX
-
Install Ghostscript
brew install ghostscript
-
Download MacTeX from https://tug.org/mactex/mactex-download.html
-
Double click on the downloaded file to install
-
Several pages of information will be displayed
-
One of the last is shown below. Click on the
Customise
button -
Deselect the packages
Ghostscript 9.50
,Ghostscript Dynamic Library
andGUI Applications
, then click onInstall
Qt
Qt is a cross-platform application development framework for desktop, embedded and mobile using C++ or Python. Supported Platforms include Linux, OS X, Windows, VxWorks, QNX, Android, iOS, BlackBerry, Sailfish OS and others.
Install Qt
- Download and run the Qt online Installer
- Click
Next
on the Welcome to the Qt Online installer window - Click
Skip
on the Qt Account window - Accept the Qt Open Source Usage Obligations, and click
Continue
- Click
Continue
no the Setup - Qt window - The installer will complain that Xcode is not installed, just click
OK
- On the Qt Creator User Experience Development window, make your choice and click
Continue
- Click
Continue
on the Installation Folder window - Select the latest Qt version prebuilt components:
- [x]
Qt 6.1.0
/macOS
- [x]
Developer and Designer Tools
/Qt Installer Framework 3.2
- [x]
- Then click
Next
andInstall
Add Qt Creator into Applications
Paste that in the terminal prompt:
# Symbolic link
ln -s "${HOME}/Qt/Qt Creator.app" "/Applications"
FFmpeg
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
Install FFmpeg
Run that in the terminal:
# Leave Python virtual environment
deactivate
# Install FFmpeg with all modules
brew install ffmpeg
OpenCV
OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library.
UPGRADE OpenCV
-
Uninstall old version:
CV_DIRS=( "/usr/local/share" "/usr/local/include" "/usr/local/lib" "/usr/local/bin" ) sudo -v for cv_dir in ${CV_DIRS[@]}; do sudo find ${cv_dir} -name "*opencv*" -exec rm -rf {} \; done
-
Remove installation directories:
rm -rf "${HOME}/opencv" rm -rf "${HOME}/opencv_contrib"
-
Install OpenCV following the instructions below!
Install OpenCV with Python and Qt support
-
Choose the version. Paste that in the terminal prompt:
# export OPENCV_VERSION="4.X.X" # export OPENCV_VERSION="3.4.X" export OPENCV_VERSION="4.6.0"
-
Easy install using mac-setup:
bash <(curl -fsSL raw.githubusercontent.com/borgesnotes/mac-setup/master/install) opencv
-
Or check out the OpenCV set-up guide with Qt support.
Contributing
All contributions are welcome! There are many ways in which you can participate in the project, for example:
- Submit bugs and feature requests
- Review the documentation and make pull requests for anything from typos to new content
If you are interested in fixing issues and contributing directly to the code base, please read our Contribution Guide.
Feedback
- Request a new feature
- File an issue
Author
License
The source code is licensed under the MIT license.
The content of this project itself is licensed under the Creative Commons Attribution 4.0 International.