Please Note: Everything on this page started
out as my personal notes on installing various packages on my
OS-X machines. Please feel free to use any of the information
here. However, I can't be responsible for any problems that
arise as a result of following these instructions. Use at
your own risk.
Computing:
Homebrew
- Homebrew is an essential tool for installing public domain packages on the mac.
- Installation instructions are here
- FAQ
- You will first need to install XCode (from the App Store), and the activate the command
line tools. To do the latter, type the following in Terminal:
xcode-select --install
- To update homebrew and the pacakages type:
brew update
brew upgrade
- Key commands:
brew update
brew doctor
brew install package
brew outdated
brew upgrade package
brew cleanup package
MySQL
- Useful Medium articles:
- Steps to install/start/run:
- Use homebrew to install latest version of mysql, to start service, and to set up security:
brew info mysql
brew install mysql
mysqladmin -u root -password 'pswd' (new pswd in single quotes)
brew tap homebrew/services
brew services list
brew services start mysql
mysql_secure_installation
- Get MySQL Workbench
- To connect to mysql in terminal:
mysql -u root -p
which will prompt for root password.
git/GitHub/bitbucket
installing git:
git learning resources:
Other git resources
- Installing git-latexdiff:
brew install git-latexdiff
Python:
installation:
- The easiest way to install python on a Mac is using Homebrew (see below)
- To install python3 using homebrew run:
brew install python
- Note: if you have previously installed python using homebrew, you might wish to uniinstall/clean the older versions before the new install:
brew uninstall --force python
brew uninstall --force python@2
cd /usr/local/lib; rm -iv python*.*
cd /usr/local/bin; rm -iv *python*
updating python with pip:
- First upgrade pip:
pip3 install --upgrade pip setuptools wheel
- For the packages I use, the installation command is:
pip3 install numpy matplotlib pandas linearmodels datetime ipython jupyter wrds tables tabulate pandas_datareader seaborn yfinance fitbit cherrypy openpyxl pymysql mysql-connector-python sqlalchemy pint dateutil
- A number of other necessary packages will be installed as dependencies
- To list outdated packages:
pip3 list --outdated
- To update outdated packages:
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
- As of 2018:09, there is an incompatability in pandas-datareader version 3.7, so I am using the
development version of this, which you can get with:
pip3 install git+https://github.com/pydata/pandas-datareader.git
python learning resources:
LaTeX/Emacs/AucTeX/etc. for Mac:
Two very good sets of instructions for installing an Emacs-based computing infrastructure are:
LaTeX: installing and updating:
- Install the LaTeX distribution from MacTeX
- After installing, to fix permissions and update all packages, in Terminal type:
- sudo chown -R $(whoami):admin /usr/local
- tlmgr update --self
- tlmgr update --all
- Shell commands for updating Latex using TeXLive (see TeXLive site):
- tlmgr update --list (to list all updates)
- tlmgr update --all (to perform all updates)
- tlmgr install pkgname (to install pkgname)
- After making any changes (including those above), be sure to run:
so that the changes will be found by the system.
emacs:
- Installing using homebrew:
brew cask install emacs
brew install aspell
- See Emacs for MacOS-X
- You may need to use package manger (command list-packages in emacs) to install "obsolete" packages.
- In the package-manager window, to upgrade all packages, in the package manger type
U
to mark all upgradable packages to be upgraded, and then x
to actually perform the new updates.
- To configure, I use Kieran Healy's emacs-starter kit, almost without modification:
- To install:
cd ~
git clone https://github.com/kjhealy/emacs-starter-kit.git .emacs.d/
- The replace the kjhealy.org file with an appropriately named .org file, modified for your environment.
Skim
(a great PDF-viewer for use with Emacs/LaTeX):
- With the proper setup, use C-c
C-v in emacs to highlight the line you
are editing in Skim. In Skim,
use Cmd+Shift+click to take you to
that point in the tex file being edited in
emacs. To setup:
- In Skim -> Preferences -> Sync:
- Check the box "Check for file changes."
- Preset: -> Custom
- Command:
-> /usr/local/bin/emacsclient
- Arguments -> -n +%line "%file"
- In Skim -> PDF:
- PDF Display -> Single Page
- Check Automatically
Resize
- Size and position the View window,
then click "Use Current View Settings
as Default"
- To force Skim to auto-reload the pdf file when it is changed, in a terminal window type:
defaults write -app Skim SKAutoReloadFileUpdate -boolean true
- If you use Beamer for presentations, Skim can display presentation notes on a second monitor while your slides are presented on the main monitor. See:
- If you use git, there is a command git-latexdiff that will compare various commits.
- To install use homebrew
- brew install git-latexdiff
which will install both, as latexdiff is a dependency.
- NOTE: The current version of latexdiff seems to put DOS CRLF's in the diff file, which means
that it won't always compile. To fix this, run:
- latexdiff old-file.tex new-file.tex | tr -d '\r' > diff.tex
and then compile diff.tex using pdflatex (and bibtex, if necessary).
- To fix git-latexdiff, you can pull the extra carriage returns out of diff file by going to
/usr/local/bin and running:
- cat git-latexdiff | sed "s/> diff.tex/| tr -d '\\\r' > diff.tex/g" > git-latexdiff-mac
- chmod a+x git-latexdiff-mac
then use git-latexdiff-mac in place of git-latexdiff.
SoftwareUpdate
- lists and installs opertaing system and other updates
- run
softwareupdate -h
for a list of commands
- Usage
- To list available updates:
softwareupdate -l
- To install updates:
softwareupdate -i package
or
softwareupdate -i -a
to update all available packages
MacAppleStore (mas)
- install mac apps from the command line
- To install with homebrew:
brew install mas
- key mas commands are:
mas help
mas list
mas search app-name
mas install app-number
mas outdated
mas upgrade package
Other Useful Mac Stuff:
TeXText add-in for Inkscape:
- Inkscape (see the link above) is amazing for
creating figures/illustrations. The TeXText extension
allow you the label the figures using LaTeX.
- To install the textext extension, do the following:
- Install Inkscape
- Important: You need to follow the
instructions for configuring XQuartz
appropriately on the Inkscape web site
(here).
- Get the latest release
of EggBot for OS-X from https://github.com/evil-mad/EggBot/releases/ and install.
- Get TeXtext
from http://pav.iki.fi/software/textext/. Open the latest textext tar.gz file (as of 4/2015
this is textext-0.4.4.tar.gz). Open this archive
and extract the python file textext.py and place
it in the folder
/usr/local/Cellar/inkscape/0.91_3/share/inkscape/extensions. Notes:
(1) verion number may be different; (2) you
may have to change the mode of textext.py ("chmod
a+x textext.py")
- In a terminal window type:
brew install
pdf2svg.
This will install a pdf->svg
converter that texttext needs.
- You may also need to install imagemagick.
- Now, to run textext, go to Extensions->Tex
Text in the Inkscape menu. A window will pop
up in which you can place your latex equations
(with $s). Hit OK and you will get the processed
equation tex-code in your figure.
- Helpful sites for this
were/are https://nicolasamiot.wordpress.com/2013/07/25/inkscape-textext-on-mac-os-x-mountain-lion/
and http://pav.iki.fi/software/textext/macports-inkscape-textext-howto.html.
Misc ssh-fixes:
- Once ssh is setup, and once key-authentication is setup, it is more secure to turn off password login.
- To do this, edit the file
/private/etc/ssh/sshd_config
, and make sure the following lines are set to no:
PermitRootLogin no
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
- To stop and restart SSHD:
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd