macOS

Figure out IP

I recently needed to get my local IP from the terminal in OSX and I found a crazy way to do that from this StackOverflow question

ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'

It does work even though I don’t really want to spend the brain power needed to understand it enough to explain it.

Finding ports in use

I found this on StackOverflow and depending on your version of macOS, use one of these:

PORT=8000
lsof -n -i4TCP:$PORT | grep LISTEN
lsof -n -iTCP:$PORT | grep LISTEN
lsof -n -i:$PORT | grep LISTEN

Speeding up Time Machine backups

Running the following command will allow Time Machine to use significant memory and CPU to do it’s work. Best to set that to 0 when you need it and 1 when you don’t.

sudo sysctl debug.lowpri_throttle_enabled=0

Changing backgrounds

When using two screens, if you enable Displays Have Seperate Spaces in your Misson Control settings that causes a bug where the backgrounds will revert on at least one of the displays back to the default.

I find this super annoying and I’m hoping when I get annoyed about this in the future I see this and remember. I will deal with changing backgrounds vs having to turn off that setting.