macOS System Tweaks and Guides for Better Experience, Productivity and Workflow🔗
Import RSA Keys to macOS Keychain🔗
Copy your id_rsa, id_rsa.pub to ~/.ssh/ folder
Step 1 - Store the key in the keychain Just do this once:
ssh-add -K ~/.ssh/[your-private-key]
Enter your key passphrase, and you won't be asked for it again.
(If you're on a pre-Sierra version of OSX, you're done, Step 2 is not required.)
Step 2 - Configure SSH to always use the keychain It seems that OSX Sierra removed the convenient behavior of persisting your keys between logins, and the update to ssh no longer uses the keychain by default. Because of this, you will get prompted to enter the passphrase for a key after you upgrade, and again after each restart.
The solution is fairly simple, and is outlined in this github thread comment. Here's how you set it up:
Ensure you've completed Step 1 above to store the key in the keychain.
If you haven't already, create an ~/.ssh/config file. In other words, in the .ssh directory in your home dir, make a file called config.
In that .ssh/config file, add the following lines:
Host * UseKeychain yes AddKeysToAgent yes IdentityFile ~/.ssh/id_rsa
Change ~/.ssh/id_rsa to the actual filename of your private key. If you have other private keys in your ~.ssh directory, also add an IdentityFile line for each of them. For example, I have one additional line that reads IdentityFile ~/.ssh/id_ed25519 for a 2nd private key.
The UseKeychain yes is the key part, which tells SSH to look in your OSX keychain for the key passphrase.
That's it! Next time you load any ssh connection, it will try the private keys you've specified, and it will look for their passphrase in the OSX keychain. No passphrase typing required.
Shell Safe rm🔗
Source shell-safe-rm github
A much safer replacement of bash
rm with ALMOST FULL features of the origin
Initially developed on Mac OS X, then tested on Linux.
safe-rm, the files or directories you choose to remove will move to
$HOME/.Trash instead of simply deleting them. You could put them back whenever you want manually.
If a file or directory with the same name already exists in the Trash, the name of newly-deleted items will be ended with the current date and time.
Install with npm:
npm i -g safe-rm
Add Alias to your zshrc config
Disable StrictHostKeyChecking in SSH🔗
To disable strict host checking on OS X for the current user, create or edit ~/.ssh/ssh_config and add the following lines:
Set macOS Hostname via CLI🔗
sudo scutil --set HostName <NewHostNameHere>
Syntax Highlighting In Nano on Mac OS X🔗
Install Nano from homebrew Create nanorc file with the syntax below
brew install nano nano ~/.nanorc
Save & Exit
sudo spctl --master-disable
sudo spctl --master-enable
Disable/Enable SIP (System Integrity Protection)🔗
Reboot your Mac into Recovery Mode by restarting your computer and holding down Command+R until the Apple logo appears on your screen.
Click Utilities > Terminal.
In the Terminal window, type in:
Press Enter and restart your Mac.
Installing rbenv (ruby send box) - Ruby alternative to the one that macOS uses🔗
Install rbenv with brew
brew install rbenv
"$(rbenv init -)" to the end of
Install a ruby version
rbenv install 2.3.1
Select a ruby version by rbenv
rbenv global 2.3.1
Open a new terminal window
Verify that the right gem folder is being used with
gem env home(should report something in your user folder not system wide)
List listening Ports and Programs and Users (netstat like)🔗
sudo lsof -i -P | grep -i "listen"
Disable "last login" at Terminal🔗
cd ~/ touch .hushlogin
sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
Fix Missing /Users/Shared Folder🔗
Create he missing /Users/Shared folder
sudo mkdir -p /Users/Shared/
Fix permissions for the /Users/Shared folder
sudo chmod -R 1777 /Users/Shared
Google Drive File Sync Fix for macOS🔗
quit Google Drive
cd ~/Library/Application\ Support/Google mv DriveFS DriveFS.old
relaunch Google Drive