This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
macos_defaults [2020-09-07 14:50:21] mi |
macos_defaults [2024-07-20 14:45:40] (current) mi [Various settings] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| =MacOS defaults | =MacOS defaults | ||
| + | |||
| + | ==Hostname | ||
| + | |||
| + | <code bash> | ||
| + | # show: | ||
| + | for n in ComputerName HostName LocalHostName; do echo "$n = $(scutil --get $n)"; done | ||
| + | |||
| + | # set new hostname: | ||
| + | host=newname; dom=example.lan | ||
| + | for n in ComputerName LocalHostName; do sudo scutil --set $n $host; done | ||
| + | sudo scutil --set HostName $host.$dom | ||
| + | </code> | ||
| ==Keyboard layout | ==Keyboard layout | ||
| Line 6: | Line 18: | ||
| sudo defaults import com.apple.HIToolbox.plist ~/Library/Preferences/com.apple.HIToolbox.plist | sudo defaults import com.apple.HIToolbox.plist ~/Library/Preferences/com.apple.HIToolbox.plist | ||
| + | ==Default shell | ||
| + | List available shells: ''cat /etc/shells'' | ||
| + | |||
| + | Change the default shell to Bash: | ||
| + | |||
| + | chsh -s /bin/bash | ||
| + | # or | ||
| + | # chsh -s /usr/local/bin/bash | ||
| + | |||
| + | Also, to stop seeing Apple's warning to use zsh, add the following line to ''~/.bash_profile'' (or ''~/.profile'' ?): | ||
| + | |||
| + | export BASH_SILENCE_DEPRECATION_WARNING=1 | ||
| + | |||
| + | So: | ||
| + | |||
| + | echo export BASH_SILENCE_DEPRECATION_WARNING=1 | tee .profile | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| ==Various settings | ==Various settings | ||
| - | Examples from https://github.com/Integralist/dotfiles/blob/cc906bd14636543e71d9c034d6507f5986a80bbd/bootstrap.sh#L7-L53 | + | ===Bash defaults |
| + | Add to ''~/.profile'' : | ||
| + | |||
| + | <code bash> | ||
| + | # Prompt color | ||
| + | export PS1='\[\e]2; \h: $PWD \a\e[32;1m\]$PWD/$\[\e[0m\] ' | ||
| + | # History | ||
| + | export HISTSIZE=2000 | ||
| + | export HISTTIMEFORMAT='%F %T ' | ||
| + | # Additional path for scripts | ||
| + | PATH=/Users/Shared/bin:$PATH | ||
| + | </code> | ||
| + | |||
| + | Other examples from https://github.com/Integralist/dotfiles/blob/cc906bd14636543e71d9c034d6507f5986a80bbd/bootstrap.sh#L7-L53 | ||
| Line 38: | Line 84: | ||
| defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string "TwoButton" | defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string "TwoButton" | ||
| </code> | </code> | ||
| + | |||
| + | ==SMB shares | ||
| + | |||
| + | Disable "You are attempting to connect to the server ..." prompt | ||
| + | |||
| + | sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization AllowUnknownServers -bool YES | ||
| + | |||
| + | ==Spotlight | ||
| + | |||
| + | Show if Spotlight indexing is enabled on the connected disks: | ||
| + | |||
| + | mdutil -s /Volumes/* | ||
| + | |||
| + | Disable it on a specific disk: | ||
| + | |||
| + | touch /Volumes/YOUR_DISK/.metadata_never_index | ||
| + | |||
| + | or | ||
| + | |||
| + | sudo mdutil -i off /Volumes/YOUR_DISK | ||
| + | |||
| + | Disable it globally (some people on the web say it shouldn't be done globally...): | ||
| + | |||
| + | sudo mdutil -a -i off | ||
| + | |||
| + | or | ||
| + | |||
| + | sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist | ||
| + | |||
| + | To re-enabe it: | ||
| + | |||
| + | sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist | ||
| + | |||
| + | or | ||
| + | |||
| + | sudo mdutil -a -i on | ||
| + | |||
| + | or for a specific disk: | ||
| + | |||
| + | sudo mdutil -i on /Volumes/YOUR_DISK | ||
| + | |||
| + | |||