Skip to content

Instantly share code, notes, and snippets.

@ryanjohnston
Last active October 22, 2018 06:19
Show Gist options
  • Save ryanjohnston/0b8a9686fd61237e6d08db105394575b to your computer and use it in GitHub Desktop.
Save ryanjohnston/0b8a9686fd61237e6d08db105394575b to your computer and use it in GitHub Desktop.
[MacOS] Tips and Suggestions #macos
#!/usr/bin/env bash
NEW_HOSTNAME="change-me"
sudo scutil --set HostName "$NEW_HOSTNAME"

This command will fix the issue of blury text on external monitors with MacOS Mojave.

defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO

Installing and configuring dwm on OS X (tested on Mountain Lion, Mavericks).

Several years old. May no longer be relevant.

HowTo

  • Install XQuartz.
  • Install dwm using Homebrew (or whatever):
        brew install dwm
  • Create a xinitrc.d script for dwm:
        mkdir ~/.xinitrc.d
        echo "USERWM=/usr/local/bin/dwm" > ~/.xinitrc.d/00-dwm.sh
        chmod +x ~/.xinitrc.d/*
  • Run XQuartz, dwm should start.

Notes

It might be useful to tweak some XQuartz settings (just press ⌘,) like full screen, clipboard, etc.

Install DWM on MacOS

Table of Contents

Install Software

XQuartz

Install XQuartz (http://xquartz.macosforge.org) which is the development version of the X11.app that ships with OS X, which means it is way more up to date. I have had some weird issues with X11.app v. 2.3-something. XQuartz 2.5.0 fixed that.

DWM

Install dwm from Homebrew, brew install dwm. This makes a bunch of necessary tweaks to the DWM configuration.

Configuration

Shell

Add the following script to $PATH, name it dwm-launch and chmod 755:

        cd ~
        while true
        do
          xsetroot -name "`date +"%Y-%m-%d %H:%M"`"
          sleep 5
        done &
        exec /usr/local/bin/dwm

Add the following to ~/.xinitrc:

        PATH=$PATH:/usr/local/bin
        xsetroot -solid '#4a525a'
        exec >>~/.xsession-errors 2>&1
        ~/bin/dwm-launch

Add the following to ~/.Xmodmap:

        remove Mod2 = Meta_L
        add Mod1 = Meta_L

X11 uxterm is launched as a non-login shell, which is undesirable. To launch uxterm as a login shell, add the following to ~/.Xdefaults:

        XTerm*foreground: white
        XTerm*background: black

Start X11

Start X11.app.

dwm should start. You need to change a few settings to make copy/paste between X11 and Aqua work:

  • Go to X11 -> Preferences... and enable Emulate three button mouse under Input.
  • Next, enable everything under Pasteboard.
  • In X11 you copy text by selecting it with the mouse, and you paste by pressing Alt and clicking the mouse.

Issues

After some time you might not be able to open new terminals. This has something to do with permissions, and can be fixed with xhost +. Do you know a permanent solution? (Possibly fixed with one of the settings under X11 -> Preferences… -> Security)

MacOS Development Setup

These notes were generated in 2015. This needs updating and may no longer be relevant.

Table of Contents

Generate new SSH keys

  ssh-keygen -t rsa 
  cp ~/.ssh/id_rsa.pub ~/Documents/public-ssh.pub

Submit your key to GitHub via account settings area.

Update GIT

Update GIT with personal info.

  vi ~/.gitconfig

Applications

Some usefull apps to install include:

Create Development Folder

Create Development folder to store GIT repos and checkout some repos.

  mkdir ~/Documents/Development
  cd ~/Documents/Development
  git clone [your useful git repo]

Install Homebrew

  ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"`  
  brew doctor
  brew tree zsh tmux macvim mysql
  /usr/local/bin/mysql_secure_installation

Oh-My-ZSH

Install oh-my-zsh.

  curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

Ruby via rbenv

Install ruby via rbenv

  brew install rbenv
  brew install ruby-build
  rbenv install [latest version of ruby]
  rbenv rehash
  echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
  rbenv [latest version of ruby]

MacOS Tips and Suggestions

Table of Contents

#!/usr/bin/env bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment