{"id":42377562,"url":"https://github.com/mcuntz/setup_mac","last_synced_at":"2026-01-27T20:52:38.348Z","repository":{"id":112172673,"uuid":"279096029","full_name":"mcuntz/setup_mac","owner":"mcuntz","description":"Setting up macOS for scientific computing","archived":false,"fork":false,"pushed_at":"2025-05-16T21:57:15.000Z","size":9987,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-16T22:32:48.473Z","etag":null,"topics":["macos","setup","setup-guide","setup-macos"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcuntz.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-12T15:45:20.000Z","updated_at":"2025-05-16T21:57:19.000Z","dependencies_parsed_at":"2024-05-03T22:37:02.125Z","dependency_job_id":"eb2631b3-b4ae-404d-8918-b86760db2780","html_url":"https://github.com/mcuntz/setup_mac","commit_stats":{"total_commits":49,"total_committers":1,"mean_commits":49.0,"dds":0.0,"last_synced_commit":"a357c34d54b9bdf798661d41e7b641b0906aa9ef"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcuntz/setup_mac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fsetup_mac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fsetup_mac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fsetup_mac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fsetup_mac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcuntz","download_url":"https://codeload.github.com/mcuntz/setup_mac/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fsetup_mac/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28822234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macos","setup","setup-guide","setup-macos"],"created_at":"2026-01-27T20:52:35.276Z","updated_at":"2026-01-27T20:52:38.340Z","avatar_url":"https://github.com/mcuntz.png","language":"Emacs Lisp","readme":"# C-c C-e  for export within Emacs\n# C-c C-l  for editing hyperlinks\n#+OPTIONS: toc:nil\n#+OPTIONS: broken-links:t\n#+TITLE: Setting up macOS for scientific computing and software development\n\nAuthor: Matthias Cuntz, mc (at) macu (dot) de\\\\\nModified: 03.05.2024\n\nInspired by guides of [[https://medium.com/faun/zero-to-hero-set-up-your-mac-for-software-development-919ede3df83b][Dirk Avery]], [[https://medium.com/better-programming/setting-up-your-mac-for-web-development-in-2020-659f5588b883][Vinicius De Antoni]], [[https://sourabhbajaj.com/mac-setup/][Sourabh Bajaj]], [[https://github.com/nicolashery/mac-dev-setup][Nicolas Hery]].\n\nThis is a reminder for myself how to setup a new Mac or updating the OS, which might be useful for others. The repository includes some of my dot-files as a reference.\n\n* Table of Contents :TOC:\n- [[#how-to-update-the-os][How to update the OS]]\n  - [[#update-via-software-update][Update via /Software Update/]]\n- [[#setup-macos][Setup macOS]]\n  - [[#check-for-system-updates][Check for system updates]]\n  - [[#xcode][Xcode]]\n  - [[#set-preferences-of-macos-and-standard-apps][Set preferences of macOS and standard apps]]\n  - [[#set-the-default-shell][Set the default shell]]\n  - [[#app-store][App Store]]\n  - [[#xquartz][XQuartz]]\n  - [[#homebrew][Homebrew]]\n  - [[#set-your-default-shell-2][Set your default shell #2]]\n  - [[#homebrew-2][Homebrew #2]]\n  - [[#emacs][Emacs]]\n  - [[#latex][LaTeX]]\n  - [[#freeware][Freeware]]\n  - [[#myriad-pro][Myriad Pro]]\n  - [[#python][Python]]\n  - [[#locate][locate]]\n  - [[#payware][Payware]]\n  - [[#additional-software][Additional software]]\n  - [[#netcdf4underfortran-and-openmpi-development-packages][netcdf4\\under{}fortran and openmpi development packages]]\n\n* How to update the OS\n  There are basically two options:\n  1. Reformat the startup disk and install a fresh new system, or\n\n  1. Use /Software Update/ to update macOS on top of the existing OS.\n\n  In both cases, a little bit of preparation helps. I do not use the first option anymore. It is covered in earlier versions of this document such as in README14.org.\n\n** Update via /Software Update/\n\n*** Before starting\n    1. It is always recommended to make a backup of your system before an upgrade.\n\n    1. Update all your installed apps in /Applications/. The newest versions of the applications will probably already be suitable for the new macOS version. It avoids the problem that you cannot open anymore the old version of the application on the new macOS just to do the update. You'd then have to uninstall/install the application again, which might need the licence key, etc.\n\n       For this, open each non-Apple application and /Check for Updates.../.\n\n       Use the /App Store.../ for all Apple programs and apps downloaded from the App Store..\n\n    1. The /Software Update/ takes care of all your accounts, passwords, etc. The step before takes care of all the installed applications. But anything installed from the command line will (most probably) not work anymore. So I first uninstall all the things that will be installed in the steps below, which are Homebrew (including the installed casks), LaTeX, Python/pyenv, and everything installed with install\\under{}netcdf. I also first set back Apple's bash shell as default because the newer bash shell used until now is removed together with Homebrew and you run into trouble if it is still set as your default shell afterwards.\n\n       Set Apple's bash shell as default:\n\n       #+BEGIN_SRC bash\n         chsh -s /bin/bash\n       #+END_SRC\n\n       You have to open a new login terminal that it takes effect.\n\n       Check the casks installed with Homebrew. This might not work anymore because you changed the shell, e.g. to /zsh/. Then copy the box below that sets the /HOMEBREW_PREFIX/ into this new login terminal ([[#homebrew][Homebrew]]).\n\n       #+BEGIN_SRC bash\n         brew list --casks\n       #+END_SRC\n\n        Best to note them somewhere (basictex font-source-code-pro emacs motrix panoply quarto temurin).\n\n        Uninstall all casks (you might have to type your password several times for this if not even for each casks):\n\n       #+BEGIN_SRC bash\n         for c in $(brew list --casks) ; do brew uninstall ${c} ; done\n       #+END_SRC\n\n       Remove Homebrew (password needed):\n\n       #+BEGIN_SRC bash\n         /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)\"\n       #+END_SRC\n       #+BEGIN_SRC bash\n         [[ -f ${HOME}/.fzf.bash ]] \u0026\u0026 rm -f ${HOME}/.fzf.bash\n       #+END_SRC\n       #+BEGIN_SRC bash\n         [[ -f ${HOME}/.fzf.zsh ]] \u0026\u0026 rm -f ${HOME}/.fzf.zsh\n       #+END_SRC\n       #+BEGIN_SRC bash\n         [[ -d /opt/homebrew ]] \u0026\u0026 sudo rm -r /opt/homebrew\n       #+END_SRC\n\n       Remove (remnants of) LaTeX:\n\n       #+BEGIN_SRC bash\n         sudo rm -r /usr/local/texlive/\n       #+END_SRC\n       #+BEGIN_SRC bash\n         sudo rm -r /Library/TeX/\n       #+END_SRC\n\n       Remove pyenv's Python versions:\n\n       #+BEGIN_SRC bash\n         rm -rf ${HOME}/.pyenv\n       #+END_SRC\n\n       Remove everything under =/usr/local=. This seems extreme but Apple has nothing installed under =/usr/local=, so it comes all from you or Homebrew. You might change into =/usr/local= and remove selected directories by hand. For example, our virus scanner at work installs its uninstall-script in =/usr/local=.\n\n       #+BEGIN_SRC bash\n         rm -rf /usr/local/*\n       #+END_SRC\n\n*** Installing macOS via /Software Update/\n\n    Go to /System Preferences/ \u003e /Software Update/ (macOS \u003c= 12) or to /System Settings/ \u003e /General/ \u003e /Software Update/ (macOS \u003e= 13). Select to install the new macOS and follow the on-screen instructions.\n\n\n* Setup macOS\n  The steps are intended to be done (roughly) in order. You have to open new login shells several times during the process. If something does not work after installation, opening a new login shell might do the trick.\n\n** Check for system updates\n   Check for updates of macOS in /System Preferences/ \u003e /Software Update/ (macOS \u003c= 12) or /System Settings/ \u003e /General/ \u003e /Software Update/ (macOS \u003e= 13).\n\n** Xcode\n   A full Xcode installation is not always needed. Most often, the Xcode Command Line Tools (CLT) are enough, for example for Homebrew. But some development software needs a full Xcode installation such as the FreePGI Fortran Compiler. So one can, for example, install the Xcode CLT only, and install the full Xcode only if another program demands it. Note that installing the full XCode takes considerable time (count rather half an hour or more).\n\n   The normal way to install the XCode Command Line Tools (CLT) from the terminal would be:\n\n   #+BEGIN_SRC bash\n     xcode-select --install\n   #+END_SRC\n\n   There was a glitch (in macOS 13 Ventura) if you installed with /Software Update/ and had a full XCode installation: the XCode Command Line Tools did not get updated so that gfortran, for example, clashes with XCode's clang compiler. So I first uninstalled CLT and reinstalled them again:\n\n   #+BEGIN_SRC bash\n     sudo rm -rf /Library/Developer/CommandLineTools\n     sudo xcode-select --install\n   #+END_SRC\n\n   On macOS 14 Sonoma, this prints /xcode-select: note: install requested for command line developer tools/\nand you have to open /Software Update/ again to install the command line tools.\n\n   This still pointed to the compiler within the XCode app:\n\n   #+BEGIN_SRC bash\n     xcode-select --print-path\n     # /Applications/Xcode.app/Contents/Developer/\n   #+END_SRC\n\n   This can be [[https://stackoverflow.com/questions/72428802/c-lang-llvm-option-parsing-unknown-command-line-argument-when-running-gfort][fixed]] by pointing to clang within the CLT:\n\n   #+BEGIN_SRC bash\n     sudo xcode-select -switch /Library/Developer/CommandLineTools\n   #+END_SRC\n\n   You might let Homebrew do the job, i.e. it will install the XCode Command Line Tools if they are missing.\n\n   The full Xcode can be installed from the App Store. You have to open it once and confirm the Usage Agreement in order to use the bundled tools. If you install Xcode, it is reasonable to complete the Xcode installation and the one-time opening before starting with [[#homebrew][Homebrew]]. Otherwise, it might install the command line tools CLT twice, but it costs only download bandwidth and time.\n\n   While waiting for XCode to install, you can download and install the other apps from [[#app-store][App Store]], [[#xquartz][XQuartz]] and some [[#freeware][Freeware]] except [[http://www.chachatelier.fr/latexit/][LaTeXiT]] and [[https://www.sourcetreeapp.com][SourceTree]]. You can also [[#set-preferences-of-macos-and-standard-apps][Set preferences of macOS and standard apps]].\n\n** Set preferences of macOS and standard apps\n   Set /System Preferences/ (macOS \u003c= 12) or /System Settings/ (macOS \u003e= 13) such as:\n   Check for updates of macOS in /System Preferences/ \u003e /Software Update/ (macOS \u003c= 12) or /System Settings/ \u003e /General/ \u003e /Software Update/ (macOS \u003e= 13) .\n\n   - Set computer name in /Sharing/ \u003e /Computer Name/ or in /General/ \u003e /Sharing/ \u003e /Local hostname/\n\n   - Unset all in /Mission Control/ or in /Desktop \u0026 Dock/ \u003e /Mission Control/\n\n   - Set /Keyboard/ \u003e /Modifier Keys.../ \u003e /Caps Lock Key/ to /No Action/ or set /Keyboard/ \u003e /Keyboard Shortcuts/ \u003e /Modifier Keys/ \u003e /Caps Lock Key/ to /No Action/\n\n   Set preferences/settings in standard macOS apps such as:\n   - Terminal\n     + Set /Profiles/ \u003e /Shell/ \u003e /When the shell exists:/ to /Close if the shell exited cleanly/\n\n     + Unset tickbox /Profiles/ \u003e /Advanced/ \u003e /Set locale environment variables on startup/\n\n   - Finder\n     + Set tickbox /Advanced/ \u003e /Show all filename extensions/\n\n** Set the default shell\n   Apple is now using /zsh/ as its default shell. If you want to stay with /bash/, change it in the terminal:\n\n   #+BEGIN_SRC bash\n     chsh -s /bin/bash\n   #+END_SRC\n\n   To get rid of the nagging reminder that the default shell is now zsh every time you open a new terminal window, set in your =.bash_profile=:\n\n   #+BEGIN_SRC bash\n     export BASH_SILENCE_DEPRECATION_WARNING=1\n   #+END_SRC\n\n   My current =.bash_profile= is as dot-bash\\under{}profile in this repository along with the two sub-config files =.bashrc= as dot-bashrc for general aliases and functions and =.bashrc.15= as dot-bashrc.15 for macOS 15 Sequoia-specific aliases and functions.\n\n** App Store\n   Even when you installed using /Software Update/, you should check for updates. Do not look only in /App Store.../ \u003e /Updates/ but also on your account (on the bottom left) if there is an update. Xcode did not show up in /Updates/ for me but I had to update it from the account page.\n\n** XQuartz\n   XQuartz is the X-window system running on macOS, needed for \\ast{}nix GUI programs. Get it from [[http://xquartz.macosforge.org/][XQuartz]].\n\n** Homebrew\n   Install [[http://brew.sh][Homebrew]] for easy \\ast{}nix package installation.\n\n   #+BEGIN_SRC bash\n     /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n   #+END_SRC\n\n   This installs Homebrew into =/usr/local= on macOS Intel and into =/opt/homebrew= on macOS Apple Silicon (M1, M2, etc.).\n\n   You might want to put into your =.bash_profile= for macOS Intel:\n\n   #+BEGIN_SRC bash\n     [[ -x $(which brew) ]] \u0026\u0026 eval $(brew shellenv)\n   #+END_SRC\n\n   and for macOS Apple Silicon (Mx):\n\n   #+BEGIN_SRC bash\n     [[ -d /opt/homebrew ]] \u0026\u0026 eval $(/opt/homebrew/bin/brew shellenv)\n   #+END_SRC\n\n   so that Homebrew can be found. This sets, for example, the environment variables =HOMEBREW_PREFIX=, =HOMEBREW_CELLAR=, and =HOMEBREW_REPOSITORY= and prepends the =$PATH= with Homebrew's bin directory. I set this manually because I want to have Homebrew's bin directory at the end rather than at the beginning of the system =$PATH= such as:\n\n   #+BEGIN_SRC bash\n     if [[ -d /opt/homebrew ]] ; then\n         # eval $(/opt/homebrew/bin/brew shellenv)\n         # or by hand to append rather than prepand path\n         export HOMEBREW_PREFIX=\"/opt/homebrew\";\n         export HOMEBREW_CELLAR=\"/opt/homebrew/Cellar\";\n         export HOMEBREW_REPOSITORY=\"/opt/homebrew\";\n         export PATH=${PATH}:/opt/homebrew/bin\n     elif [[ -e /usr/local/bin/brew ]] ; then\n         export HOMEBREW_PREFIX=\"/usr/local\";\n         export HOMEBREW_CELLAR=\"/usr/local/Cellar\";\n         export HOMEBREW_REPOSITORY=\"/usr/local\";\n         export PATH=${PATH}:/usr/local/bin\n     fi\n   #+END_SRC\n\n** Set your default shell #2\n   Apple moved to /zsh/ because of the license change of /bash/ from GPLv2 to GPLv3 with its version 4.0. The current bash shell on macOS is hence 3.2 from 2007. If you want to use the latest version of /bash/, install it with Homebrew, \"whitelist\" the new shell as a login shell, and choose it as your default login shell:\n\n   #+BEGIN_SRC bash\n     brew install bash\n   #+END_SRC\n   #+BEGIN_SRC bash\n     # add the following line to /etc/shells\n     # /usr/local/bin/bash\n     # or\n     # /opt/homebrew/bin/bash\n     sudo nano /etc/shells\n   #+END_SRC\n   #+BEGIN_SRC bash\n     chsh -s ${HOMEBREW_PREFIX}/bin/bash\n   #+END_SRC\n\n   Note that your shell scripts will probably still use the Apple default bash shell because they often have the shebang line =#!/bin/bash=. The most portable way to write shell scripts is to use =#!/usr/bin/env bash= as your shebang. This will take the first /bash/ in your =$PATH=, which would now be =/usr/local/bin/bash= or =/opt/homebrew/bin/bash=.\n\n   You can now use /bash-completion/ with the new bash shell.\n\n   #+BEGIN_SRC bash\n     brew install bash-completion@2\n   #+END_SRC\n\n   You then have to put the following lines in your =.bash_profile= to use bash-completion:\n\n   #+BEGIN_SRC bash\n     if [[ -f \"${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh\" ]] ; then\n         export BASH_COMPLETION_COMPAT_DIR=\"${HOMEBREW_PREFIX}/etc/bash_completion.d\"\n         source \"${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh\"\n     fi\n   #+END_SRC\n\n   Note that these lines have to be after the sourcing of =.fzf.bash= in your =.bash_profile= if you installed /fzf/, otherwise you get an error such as =programmable_completion: source: possible retry loop=.\n\n   You can do the exact same steps for the zsh shell. Apples version of /zsh/ is rather new but if you want to have the newest developments, install /zsh/ with Homebrew, whitelist it and use it as your default shell. If you use /zsh/, you might want to check out [[https://ohmyz.sh][Oh My ZSH]] for easy configuration of /zsh/.\n\n   After a system update such as from /System Preferences/ \u003e /Software Update/, there might be a link =Relocated Items/= on your Desktop pointing to =/Users/Shared/Relocated Items=. This is a copy of the changed =/etc/shells=. As long as Apple does not modify =/etc/shells= during an update, the edited version stays untouched, though. One can safely delete the link on the Desktop and also the directory under =/Users/Shared=. It does not hurt to do a =cat /etc/shells= in the terminal before, checking that your edits are still there.\n\n** Homebrew #2\n\n   - *GNU compiler and netCDF software*\n\n     The gcc suite includes /gfortran/. /make/ is the build system of various software packages.\n     Install /nco/, /ncview/, and /Panoply/ to work with and visualise netCDF files. This installs the netcdf-C version, which comes with /ncdump/, etc. Homebrew had netcdf-C, netcdf-C++, and netcdf-Fortran bundled in /netcdf/ before. They are individual packages now. /netcdf/ installs the netcdf-C package only. See install\\under{}netcdf below for Fortran support.\n\n     #+BEGIN_SRC bash\n       brew install gcc\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install cmake\n     #+END_SRC\n     #+BEGIN_SRC bash\n       # geos and gdal take considerable time to install\n       for i in geos gdal nco ncview ; do brew install ${i} ; done\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install cdo\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install --cask temurin  # Java, for panoply\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install --cask panoply\n     #+END_SRC\n\n     /HDF5/ from Homebrew is not thread-safe so /cdo/ will need the -L flag if piping, i.e. more than one operator is given to /cdo/ in one call such as =cdo -timmean -selvar,Tair infile outfile=. I use in my =.bashrc=:\n\n     #+BEGIN_SRC bash\n       alias cdo=\"cdo -L\"\n     #+END_SRC\n\n     Note that =cdo -L= instead of purely =cdo= must also be used in scripts for piping.\n\n   - *Install more practical software*\n\n     Some more practical software such as, /fd/ for a faster find, /ripgrep/ for grepping across a directory tree, the statistical computing environment /R/, the version control system /subversion/, and the command-line fuzzy finder /fzf/, and the tldr implementation /tealdeer/ for more concise help pages:\n\n     #+BEGIN_SRC bash\n       brew install htop        # dynamic real-time information of running processes\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install tree        # visualise folder tree structure\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install fd          # faster find\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install bat         # cat with syntax highlighting\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install ripgrep     # grep across directory tree\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install fzf         # command-line fuzzy finder\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install wget        # retrieve files from web servers\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install tealdeer    # simples help pages for command-line tools\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install ghostscript # postscript and pdf language interpreter\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install enscript    # convert text files to postscript files\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install imagemagick # image manipulations\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install ffmpeg      # for movies\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install pandoc      # convert between markup languages\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install pkg-config  # reveal details of installed libraries\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install graphviz doxygen # documentation for programming languages\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install subversion  # version control system\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install git         # version control system\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install rsync       # better Unicode support in newer rsync versions\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install r           # statistical computing environment\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install --cask quarto  # jupyter/Rmarkdown like notebooks in markdown\n     #+END_SRC\n     #+BEGIN_SRC bash\n       brew install --cask motrix  # download manager\n     #+END_SRC\n\n     And some installations of the helpers:\n\n     #+BEGIN_SRC bash\n       ${HOMEBREW_PREFIX}/opt/fzf/install\n     #+END_SRC\n     #+BEGIN_SRC bash\n       tldr --update\n     #+END_SRC\n\n     I also set =${HOME}/.tealdeer= as my configuration directory for /tealdeer/ in =.bash_profile=,\n\n     #+BEGIN_SRC bash\n       export TEALDEER_CONFIG_DIR=${HOME}/.tealdeer\n     #+END_SRC\n\n     and get a standard config file =${HOME}/.tealdeer/config.toml= that I edit to tailor to my taste:\n\n     #+BEGIN_SRC bash\n       tldr --seed-config\n     #+END_SRC\n\n** Emacs\n   I used to use [[http://aquamacs.org][Aquamacs]], then used [[https://www.spacemacs.org][Spacemacs]], and then tried a few other setups ([[https://github.com/doomemacs/doomemacs][doom]], [[https://github.com/angrybacon/dotemacs][dotemacs]], [[https://codeberg.org/kngwyu/boremacs][boremacs]], [[https://github.com/abougouffa/minemacs][minemacs]], etc.). Now I am using my own setup by copy/paste different bits from the other setups. My current setup is in =dot-emacs.d= in this repository.\n\n   I install Emacs with Homebrew:\n\n   #+BEGIN_SRC bash\n     brew install --cask emacs\n   #+END_SRC\n\n   Coming from another Emacs, backup =.emacs= and =.emacs.d=:\n\n   #+BEGIN_SRC bash\n     cd ${HOME}\n     if [[ -f .emacs ]] ; then mv .emacs .emacs.bak ; fi\n     if [[ -d .emacs.d ]] ; then mv .emacs.d .emacs.d.bak ; fi\n   #+END_SRC\n\n   Then I install my setup by copying it to =~/.emacs.d=.\n\n   I use the font [[https://github.com/adobe-fonts/source-code-pro][Source Code Pro]] that is also used in Spacemacs, install aspell for spell checking, and [[https://github.com/astral-sh/ruff][ruff]] for linting Python code:\n\n   #+BEGIN_SRC bash\n     brew install --cask font-source-code-pro\n   #+END_SRC\n   #+BEGIN_SRC bash\n     brew install aspell\n   #+END_SRC\n   #+BEGIN_SRC bash\n     brew install ruff\n   #+END_SRC\n\n   If you open the new Emacs for the first time, it will install and byte-compile some packages. This might take some time.\n\n** LaTeX\n   One can download LaTeX from [[https://tug.org/mactex/][MacTeX]] or use a Homebrew cask. I have chosen Homebrew's cask this time because I use the BasicTeX installation and I let Homebrew handle the update between years (=brew upgrade --cask basictex=), which is always a hassle otherwise.\n\n   #+BEGIN_SRC bash\n     brew install --cask basictex\n   #+END_SRC\n\n   If you chose BasicTeX, then install immediately a few LaTeX packages, which I encountered during different projects:\n\n   #+BEGIN_SRC bash\n     sudo tlmgr update --self ; \\\n     sudo tlmgr install \\\n\t  a0poster a4wide acronym adjustbox algorithmicx \\\n\t  algorithms anyfontsize apacite appendix arydshln \\\n\t  biber biblatex biblatex-apa biblatex-chicago \\\n\t  bigfoot blindtext boondox breakurl capt-of changepage \\\n\t  changes chemfig cleveref cmbright collectbox \\\n\t  collection-fontsrecommended collection-fontutils comment \\\n\t  cormorantgaramond csquotes dinbrief doi doublestroke \\\n\t  draftwatermark dvipng easy elsarticle enumitem \\\n\t  environ etoolbox everypage floatflt floatrow fltpoint \\\n\t  fncychap fontawesome5 fontaxes fontinst footmisc  \\\n\t  framed gensymb german glossaries glossaries-extra \\\n\t  gradientframe helvetic hyphenat ifmtarg kastrup \\\n\t  lastpage latexmk lettrine lineno lipsum \\\n\t  listingsutf8 makecell marginnote mdframed mdsymbol \\\n\t  mhchem minitoc mnsymbol moreverb multirow mwe  \\\n\t  ncctools needspace newtx nomencl ntheorem pbox \\\n\t  pdfcol pdfcrop pgf pgfgantt placeins preprint program psnfss \\\n\t  regexpatch sectsty sidecap simplekv siunitx soul \\\n\t  stmaryrd sttools subfigure subfiles supertabular \\\n\t  tabfigures tabulary tcolorbox textpos threeparttable \\\n\t  tikzfill titlesec titling todonotes truncate type1cm \\\n\t  ucs ulem units varwidth vruler wallpaper was wasy \\\n\t  wasysym wrapfig xcolor xifthen xkeyval xstring \\\n\t  arev bera fira iwona kurier lato ly1 mathastext newtxsf \\\n\t  opensans psnfss sansmathfonts sfmath sourcesanspro\n   #+END_SRC\n\n   I also install LaTeXML so that Emacs' org-mode can convert LaTeX equations to MathML on export:\n\n   #+BEGIN_SRC bash\n     brew install latexml\n   #+END_SRC\n\n** Freeware\n   Some essential Freeware for me:\n   - [[http://www.freemacsoft.net/appcleaner/][AppCleaner]], for removing apps and all their traces,\n\n   - [[https://acrobat.adobe.com/us/en/acrobat/pdf-reader.html][Adobe Reader]], because Preview has problems with some PDFs,\n\n   - [[https://www.mozilla.org/en-US/firefox/all/][Firefox Developer Edition]], Safari is not always supported. [[https://www.google.com/chrome/][Chrome]] is probably the most supported browser. I sometimes also use [[https://www.opera.com][Opera]],\n\n   - [[http://www.chachatelier.fr/latexit/][LaTeXiT]], exporting LaTeX equations as graphics,\n\n   - [[https://rectangleapp.com][Rectangle]], moving windows with keystrokes,\n\n   - [[https://www.zotero.org][Zotero]], reference manager,\n\n   - [[http://www.skype.com/en/][Skype]], video calls, I still use it,\n\n   - [[https://www.sourcetreeapp.com][SourceTree]], git GUI originally for bitbucket but works with other git repositories as well,\n\n   - [[https://www.spotify.com/][Spotify]], streaming music,\n\n   - [[http://www.videolan.org/vlc/][VLC]], video player for all formats,\n\n   - [[https://github.com/markummitchell/engauge-digitizer][Engauge Digitizer]], recover data points from graphs.\n\n** Myriad Pro\n   I like the Myriad Pro font and AGU journals currently use it. The Myriad Pro font comes with the Adobe Acrobat Reader.\n\n   To install for non-LaTeX programs, one can install in Font Book the four /otf/-files from the directory '/Applications/Adobe Acrobat Reader DC.app/Contents/Resources/Resource/Font'.\n\n   An extended set of glyphs are given in the zip file 'MyriadPro.zip':\\\\\n   unzip MyriadPro.zip and drag the folder with the .otf files into Font Book.\n\n   To install Myriad Pro for LaTeX, using the Adobe fonts, one can launch the following commands in terminal:\n\n   #+BEGIN_SRC bash\n     for i in fontinst fltpoint tabfigures mnsymbol mdsymbol \\\n         collection-fontutils ; do \\\n         sudo tlmgr install ${i} ; done\n     git clone https://github.com/sebschub/FontPro.git\n     cd FontPro\n     mkdir otf\n     FONT=MyriadPro\n     cp \"/Applications/Adobe Acrobat Reader.app/Contents/Resources/Resource/Font/\"${FONT}*.otf otf/\n     ./scripts/makeall ${FONT}\n     echo y | sudo ./scripts/install\n     sudo updmap-sys --enable Map=${FONT}.map\n     sudo -H mktexlsr\n     kpsewhich ${FONT}.map\n     cd ..\n     \\rm -fr FontPro\n   #+END_SRC\n\n** Python\n\n   macOS Catalina (10.15) still came with Python version 2.7.16 as its default version. Official support for Python 2 has ended Januar 2020. So you want to install Python 3. From macOS Big Sur (11.5) onwards, macOS comes with Python 3 (from macOS 13 Ventura, is is actually part of the XCode command line tools). But I still recommend to install Python with /pyenv/ and /pyenv-virtualenv/: you can install different Python versions, use different virtual environments in different directories (projects) very easily, etc.\n\n   Installation of Python versions can be a real mess at times, as noted by [[https://xkcd.com/1987/][XKCD]]:\n\n   #+ATTR_HTML: :alt Python path on my system :align center :width 300 :height 300\n   [[https://imgs.xkcd.com/comics/python_environment.png]]\n\n   /pyenv/ and /pyenv-virtualenv/ makes that very easy: see the great article [[https://medium.com/faun/pyenv-multi-version-python-development-on-mac-578736fb91aa][pyenv: Multi-version Python development on Mac]] by Dirk Avery.\n\n   To install pyenv with Homebrew:\n\n   #+BEGIN_SRC bash\n     brew install openssl readline sqlite3 xz zlib\n     brew install pyenv\n     brew install pyenv-virtualenv\n   #+END_SRC\n\n   You have to set the following in your =.bash_profile= so that the shell always finds the currently chosen Python version as the first entry.\n\n   #+BEGIN_SRC bash\n     export PYENV_ROOT=\"${HOME}/.pyenv\"\n     export PATH=${PYENV_ROOT}/shims:${PATH}\n     if command -v pyenv 1\u003e/dev/null 2\u003e\u00261 ; then eval \"$(pyenv init -)\" ; fi\n     if command -v pyenv virtualenv-init 1\u003e/dev/null 2\u003e\u00261 ; then eval \"$(pyenv virtualenv-init -)\" ; fi\n   #+END_SRC\n\n   Note that the =$PATH= environment must be prepended with =${PYENV_ROOT}/shims= and not =${PYENV_ROOT}/bin= as given in the (older) user guide. Also, this has to be done /after/ the addition of Homebrew to the system =$PATH= so that the pyenv Python installation can be found first; otherwise Homebrew's Python will be found first.\n\n   - *pyenv and pyenv-virtualenv 101*\n\n     After starting a new shell, for example by doing =exec ${SHELL}=, you can start installing and using different Python versions (but see my installation below):\n\n     #+BEGIN_SRC bash\n       pyenv install --list\n       pyenv install 3.13.1\n       pyenv global 3.13.1\n     #+END_SRC\n\n     Try to rehash first if a problem occurs with /pyenv/: =pyenv rehash=. For example, some new Homebrew packages might upgrade /pyenv/ as well. Then you get an error such as:\n\n     #+BEGIN_SRC bash\n       /Users/cuntz/.pyenv/shims/python: line 21:\n       /usr/local/Cellar/pyenv/2.3.12/libexec/pyenv:\n       No such file or directory\n     #+END_SRC\n\n     =pyenv rehash= resolves the issue.\n\n     Note that I actually install Python versions currently as follows:\n\n     #+BEGIN_SRC bash\n       # most probably already installed\n       brew install openssl readline sqlite3 xz zlib tcl-tk@8\n     #+END_SRC\n     #+BEGIN_SRC bash\n       env LDFLAGS=\" \\\n           -L$(brew --prefix openssl)/lib \\\n           -L$(brew --prefix readline)/lib \\\n           -L$(brew --prefix sqlite3)/lib \\\n           -L$(brew --prefix xz)/lib \\\n           -L$(brew --prefix zlib)/lib \\\n           -L$(brew --prefix tcl-tk@8)/lib\" \\\n           CPPFLAGS=\" \\\n           -I$(brew --prefix openssl)/include \\\n           -I$(brew --prefix readline)/include \\\n           -I$(brew --prefix sqlite3)/include \\\n           -I$(brew --prefix xz)/include \\\n           -I$(brew --prefix zlib)/include \\\n           -I$(brew --prefix tcl-tk@8)/include\" \\\n           PKG_CONFIG_PATH=\"$(brew --prefix openssl)/lib/pkgconfig:$(brew --prefix readline)/lib/pkgconfig:$(brew --prefix sqlite3)/lib/pkgconfig:$(brew --prefix xz)/lib/pkgconfig:$(brew --prefix zlib)/lib/pkgconfig:$(brew --prefix tcl-tk@8)/lib/pkgconfig\" \\\n        PYTHON_CONFIGURE_OPTS=\" \\\n        --enable-optimizations\" \\\n        pyenv install 3.13.1\n     #+END_SRC\n\n     This uses the newer Tcl/Tk version 8.6 from Homebrew for /tkinter/ (but not v9.0) and turns on profile guided optimization as well as link time optimization for Python, being then about 10% faster than without optimization. Optimization takes significantly more time to install Python. If you do not use /tkinter/ and just want to try out a Python version, =pyenv install 3.13.1= is just fine. Otherwise I recommend the optimization because you do not install Python too often but get a significant gain.\n\n     Virtual environments are then created as:\n\n     #+BEGIN_SRC bash\n       pyenv virtualenv 3.13.1 mypy\n     #+END_SRC\n\n     The virtual environment /mypy/ can then be used just as any installed Python version with /pyenv/. For example, use virtual environment /mypy/ in the current shell:\n\n     #+BEGIN_SRC bash\n       pyenv activate mypy\n     #+END_SRC\n\n     Or always use /mypy/ in the current directory:\n\n     #+BEGIN_SRC bash\n       pyenv local mypy\n     #+END_SRC\n\n     /pyenv/ provides also /anaconda/, /miniconda/, /miniforge/, etc. with which you can use conda environments:\n\n     #+BEGIN_SRC bash\n       pyenv install miniforge3-latest\n       pyenv global miniforge3-latest\n       pyenv virtualenv mypy\n     #+END_SRC\n\n     You can then install (conda, mamba, and pip) packages in the project:\n\n     #+BEGIN_SRC bash\n       conda install numpy scipy matplotlib-base\n     #+END_SRC\n\n     If git tells /gettext not found/ after installing anaconda/miniconda, see [[https://github.com/nicolashery/mac-dev-setup][Nicolas Hery]].\n\n   - *Essential Python packages*\n\n     Anaconda comes with hundreds of packages. I tend to use a Python version with pyenv or miniforge and install my essential packages with /pip/ or /conda/mamba/. These are currently in my main environment:\\\\\n     numpy, scipy, matplotlib, cartopy, ipython, jupyter, pandas, cftime, netcdf4, statsmodels, scikit-learn, xlrd, openpyxl, mpi4py, schwimmbad, xarray, numpydoc, pytest, pytest-cov, gdal, f90nml, pykdtree, cython, pyshp, six, wheel, sphinx, sphinx_book_theme\n\n     and mostly this subset in other virtual environments:\\\\\n     numpy, scipy, matplotlib, pandas, netcdf4, xarray, ipython, wheel\n\n     There is/was a problem with Apple's Accelerate framework on Apple Silicon (M1/2) so that one should use /OpenBLAS/. You also need to tell /pip/ where to find the HDF5 library and the GEOS library and the like. You do not need the lines with =OPENBLAS= and =HDF5-DIR= if you are on macOS on Intel and Homebrew installs into =/usr/local=; this directory is searched automatically. Here I install my standard python virtual environment (pystd):\n\n     #+BEGIN_SRC bash\n       # essential subset\n       if [[ \"$(uname -m)\" == \"arm64\" ]] ; then\n           export OPENBLAS=\"$(brew --prefix openblas)\"\n           export HDF5_DIR=\"$(brew --prefix hdf5)\"\n           export GEOS_DIR=\"$(brew --prefix geos)\"\n           export GEOS_CONFIG=\"$(brew --prefix geos)/bin/geos-config\"\n       fi\n     #+END_SRC\n     #+BEGIN_SRC bash\n       pyenv virtualenv 3.13.1 pystd\n       pyenv global pystd\n     #+END_SRC\n     #+BEGIN_SRC bash\n       # test if install works\n       python -m pip install numpy\n     #+END_SRC\n     #+BEGIN_SRC bash\n       for i in wheel scipy matplotlib ipython pandas cftime netcdf4 \\\n           xarray ipython ; do \\\n           python -m pip install ${i} ; done\n     #+END_SRC\n     #+BEGIN_SRC bash\n       # other standard packages\n       for i in jupyter statsmodels scikit-learn schwimmbad \\\n           numpydoc pytest pytest-cov f90nml pykdtree cython pyshp six \\\n           xlrd openpyxl ; do \\\n           python -m pip install ${i} ; done\n     #+END_SRC\n     #+BEGIN_SRC bash\n       # other developping packages\n       for i in sphinx sphinx_book_theme  ; do \\\n           python -m pip install ${i} ; done\n     #+END_SRC\n     #+BEGIN_SRC bash\n       # shapely and gdal for cartopy\n       # shapely needs to be built from source to link to geos.\n       # Uninstall it if already installed\n       [[ -z $(python -m pip freeze | grep shapely) ]] \u0026\u0026 \\\n           python -m pip uninstall -y shapely\n       python -m pip install shapely --no-binary shapely\n     #+END_SRC\n     #+BEGIN_SRC bash\n       # gdal needs to know the installed gdal version\n       # and install numpy-based raster support\n       # test: python3 -c 'from osgeo import gdal_array'\n       pip install --no-cache --force-reinstall gdal[numpy]==\"$(gdal-config --version).*\"\n     #+END_SRC\n     #+BEGIN_SRC bash\n       python -m pip install cartopy\n       # basemap is back in development again :-)\n       # but does not work with Python 3.12 yet :-(\n       # python -m pip install basemap-data\n       # python -m pip install basemap-data-hires\n       # python -m pip install basemap\n       # mpi4py will be installed after installing openmpi later\n     #+END_SRC\n\n** locate\n   Create locate database so that you can search files with the locate command:\n\n   #+BEGIN_SRC bash\n     sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist\n   #+END_SRC\n\n   This might already be running (/Operation already in progress/ or /Load failed: 5: Input//output error/).\n\n** Payware\n   Install Payware, which is for me:\n   - Microsoft Office,\n\n   - [[https://www.antidote.info/en][Antidote]], spell and grammar checker for English and French,\n\n   - [[http://www.nag.co.uk/downloads/npdownloads.asp][NAG compiler]], very meticulous Fortran compiler,\n\n   - [[https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html][Intel oneAPI Base Toolkit]] and [[https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html][Intel oneAPI HPC Toolkit]], C/C++/Fortran compiler producing very fast code,\n\n   - [[https://www.cyberghostvpn.com/][CyberGhost]], VPN client,\n\n** Additional software\n   Install additional software from you institution or similar such as VPN clients, cloud services, etc. For INRAE this is: WithSecure Antivirus, GlobalProtect VPN, StorageMadeEasy.\n\n** netcdf4\\under{}fortran and openmpi development packages\n   You can install [[https://downloads.unidata.ucar.edu/netcdf/][netcdf-fortran]] for the gfortran compiler.\n\n   #+BEGIN_SRC bash\n     brew install netcdf-fortran\n   #+END_SRC\n\n   This will automatically update netcdf-fortran for gfortran if a newer version of netcdf-C and/or netcdf-fortran becomes available.\n\n   However, if you use other Fortran compilers as well, you might want to use the script [[https://github.com/mcuntz/install_netcdf][install\\under{}netcdf]] to install it and not flood your namespace with different versions of =netcdf.mod=, etc. The script [[https://github.com/mcuntz/install_netcdf][install\\under{}netcdf]] installs netcdf-fortran, openmpi, and/or mpich development packages for different Fortran compilers. The script is well documented and we just describe the general steps.\n\n   - Look for the latest versions (numbers) of [[https://downloads.unidata.ucar.edu/netcdf/][netcdf-fortran]], [[https://www.open-mpi.org][openmpi]], and/or [[http://www.mpich.org/downloads/][mpich]] (addresses are also given at the beginning of the script) and set them below /donetcdf4\\under{}fortran/, /doopenmpi/, and/or /dompich/.\n\n   - Set /donetcdf4\\under{}fortran/, /doopenmpi/, and/or /dompich/ to 1.\n\n   - Check that ~prefix=/usr/local~.\n\n   - Set Fortran compiler, e.g. ~fortran_compilers=\"gfortran\"~.\n\n   - For Intel, you need to source the compiler setup script such as:\n\n   #+BEGIN_SRC bash\n     source /opt/intel/bin/compilervars.sh intel64\n   #+END_SRC\n\n   - For PGI, you also have to set the ~PGIPATH~.\n\n   - Run the script on the command line and give your sudo password if you install into ~prefix=/usr/local~.\n\n   After having installed /openmpi/, one can also install /mpi4py/ in Python, for example:\n\n   #+BEGIN_SRC bash\n     env MPICC=/usr/local/openmpi-4.1.7-gfortran/bin/mpicc python -m pip install mpi4py\n   #+END_SRC\n\n   However, homebrew upgrades also netcdf-C to newer versions if you install or update a package that depends on it. Then the netcdf-fortran package installed with install\\under{}netcdf will not work anymore (it will link to the old, uninstalled C version) and you have to rerun the script [[https://github.com/mcuntz/install_netcdf][install\\under{}netcdf]] with /donetcdf4\\under{}fortran=1/ and ~fortran_compilers=\"gfortran\"~. I still do it this way to minimize conflicts between different Fortran compilers; and re-installing netcdf-fortran with install\\under{}netcdf is very fast.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcuntz%2Fsetup_mac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcuntz%2Fsetup_mac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcuntz%2Fsetup_mac/lists"}