MAC Tips & Tricks
Reinstall a MAC
See procedure on: https://support.apple.com/en-us/HT204904
Apple silicon: Turn on your Mac and continue to press and hold the power button until you see the startup options window, which includes a gear icon labeled Options. Select Options, then click Continue.
Intel processor: Make sure that your Mac has a connection to the internet. Then turn on your Mac and immediately press and hold Command (⌘)-R until you see an Apple logo or other image.
You can Erase all the disk, then you just need an internet connection to activate the MAC. Then he will download from Apple the OS (it take 1h to download)
Install Brew (Package Manager)
/ Install Homebrew -> the package manager of Mac (like apt-get on Linux)
// Go to https://brew.sh
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install bash auto completion
$ brew install bash-completion
Pipe the output of a CLI program execution (output and error on a file)
(More info on https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file)
$ command 2>&1 | tee outputCollectedProgExec.txt
Remove content of a directory
$ rm -R folder
// remove all his content
Define Environment variable
// List the Env variable defined on the mac
$ env
// To echo the value of one env variable:
$ echo $HOME
//Set it
$ export HOME = "user/test/..."
Find if a file is present and what is his path
$ sudo find /opt -iname "llvm-config" -print
// Replace "llvm-config" with the file you look for
Display Hidden files
$ defaults write com.apple.finder AppleShowAllFiles YES; killall Finder
//https://apple.stackexchange.com/questions/406762/keyboard-shortcut-to-show-hidden-files-on-macos-big-sur
Last updated
Was this helpful?