====== Apple ====== First time configuration of a new Macintosh. Updated for macOS Sierra 10.12 ===== Configuration ===== * System Preferences: * Trackpad -> Tap to Click (For not having to press hard for a click.) * Tap-and-drag: Accessibility -> Pointer Control -> Trackpad Options and enable 'Dragging (without) Drag Lock' * Open the Photos app, and drag [[https://dlma.com/avatars/|a userpic]] to it. Then change your userpic in the System Preferences. * Set your [[http://gallery.dlma.com/index.php/miscellaneous/chinesemoon|desktop image to Chinese Moon]]. * Get [[http://www.google.com/chrome/intl/en/landing_chrome.html?hl=en&platform=mac|Chrome]] (Login and sync.) * [[http://www.tekrevue.com/tip/show-path-finder-title-bar/|Show the full path in the finder]] with defaults write com.apple.finder _FXShowPosixPathInTitle -bool true; killall Finder * Download and install [[https://ghostty.org/download|Ghostty]]. * Set bash as your default shell (seem [[https://stackoverflow.com/questions/77052638/changing-default-shell-from-zsh-to-bash-on-macos-catalina-and-beyond|to need to install via brew]]): ''chsh -s /bin/bash'' * System Preferences: * Set some of these [[https://medium.com/macoclock/macos-finder-sucks-4ab191e07c40|Finder preferences]] * Mouse * Make tracking speed much faster! * Enable Secondary click for the right mouse button * 2017-01-15 (still needed): Consider [[http://pilotmoon.com/scrollreverser/|Scroll Reverser]] to have [[http://apple.stackexchange.com/questions/116617/how-to-separate-mouse-and-trackpad-settings|natural scrolling for trackpad, but reversed for the mouse]]. * Disable [[http://apple.stackexchange.com/questions/159180/yosemite-disabling-inertia-scrolling-using-scroll-wheel-for-the-mouse|inertia mousewheel scrolling]] with:defaults write .GlobalPreferences com.apple.scrollwheel.scaling -1 * Get SteerMouse (linked below) to stop wheel acceleration (Or [[http://www.logitech.com/en-us/428/146?section=downloads&bit=&osid=9|Logitech V200 LCC]]) * Keyboard * Set Key Repeat to fastest, and Delay until Repeat to second shortest. * Some apps don't repeat anything because some keys have a character accent menu. To disable: defaults write -g ApplePressAndHoldEnabled -bool false * 2024 Microsoft Natural Ergonomic Keyboard needs [[https://karabiner-elements.pqrs.org/|Karabiner Elements]] to make the following two swaps: * left_option -> left_command * application -> left_option * Swap the Option and Command keys. * Dock * Position on Right * Automatically show and hide dock * iTerm2 * User Powerline Fonts per [[private:fonts]]. * Outlook * Turn off auto underline-to-italic, dashes, smart quotes: Preferences -> AutoCorrect then click on the AutoFormat page ===== Tools Installation ===== The old way of installing Command Line Tools from the Terminal doesn't work anymore. But now it can be done from [[https://developer.apple.com/download/more/?=command%20line%20tools|the Developer download site]], not from the Terminal. ==== BSD vs. Linux commands ==== macOS comes with BSD grep pre-installed, which doesn't use the Perl -P flag. Go to http://brew.sh/ and run the installation command. (See [[https://git.dlma.com/dotfiles.git/commit/fc19c7b34f522f3f22a32418c9da55df6b9b5f0e|this .bash_profile change for how we use default names for GNU ctags, find, grep and sed]].) After installation, it said: ==> Next steps: - Run these commands in your terminal to add Homebrew to your PATH: echo >> /Users/dblume/.zprofile echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/dblume/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" - Run brew help to get started - Further documentation: https://docs.brew.sh brew install grep gnu-sed findutils universal-ctags brew install gawk jq tree httpie inetutils pv brew install gnupg socat wget nmap tmux saulpw/vd/visidata brew install ripgrep moreutils neovim brew install bash-completion # See .bash_profile Ensure your prompt has git hints. See .bashrc for __git_ps1 (maybe download .git-prompt.sh). To install gnuplot 6.0 with "block" display for Braille chars, see [[gnuplot#instructions-for-macos]] Log out of that console window and log back in again. ==== tmux and "tmux-256color" ==== We set tmux to set $TERM to "tmux" so that neovim's highlight can include italics. And we bump it to "tmux-256color" so that VisiData can make use of all its colors. (Dot plot AirPassengers.csv but don't set the month column to any format.) VisiData will complain it "could not find terminfo database". So we [[https://gist.github.com/nicm/ea9cf3c93f22e0246ec858122d9abea1?permalink_comment_id=4206886#gistcomment-4206886|manually use the one provided by a tmux developer]]... curl -O "https://gist.github.com/nicm/ea9cf3c93f22e0246ec858122d9abea1/raw/37ae29fc86e88b48dbc8a674478ad3e7a009f357/tmux-256color" sudo tic -x tmux-256color That should install the database into /usr/share/terminfo ===== Tips ===== ^ Shortcut ^ Action ^ | Command+space | Spotlight (Very handy!) | | Command+W | Close the window. | | Command+Q | Quit the application. (Closing its windows isn't enough.) | | Command+click | Open the link in another tab. | | Command+Tab | Switch between applications. | | Command+` | Switch between windows within the application. | | Command+Opt+Esc | Force Quit the application | | Shift+Opt+Command+V | Paste without formatting | ===== Daemons, Agents, Cron, Launchd ===== The preferred way to set a repeating task is not to use a cronjob but launchd. :!: Note that there's a breaking change in macOS Catalina. [[https://www.reddit.com/r/MacOS/comments/dffpzj/launchd_agent_no_longer_functions_after_catalina/|Launchd agent no longer functions after Catalina upgrade]]. In your ~/bin directory, create a job to run, tag_ip_address.sh #!/usr/bin/env bash curl --data "`hostname -s`=`ifconfig | /usr/local/bin/grep "inet " | grep -v "127.0.0.1" | \ sed -E 's/.*inet (([0-9]+.){3}[0-9]+).*/\1/' | perl -p -e 'chomp if eof;s/\n/,/'`&auth=[your secret auth]" "https://kvs.dlma.com" sleep 11 # if launched as a daemon, live for 11s to not be detected as buggy. That "sleep 11" is to mitigate the buggy daemon detection mentioned [[https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html|here]]. Note that we had to specify the path to the homebrew grep, because LaunchAgent would use the default one instead. cd into ~/Library/LaunchAgents or (/Library/LaunchDaemons if it can really be a daemon) and add a new plist file Label com.dlma.tag_ip_address Program /Users/dblume/bin/tag_ip_address.sh StandardOutPath /tmp/com.dlma.tag_ip_address.plist.out.txt StandardErrorPath /tmp/com.dlma.tag_ip_address.plist.err.txt StartCalendarInterval Hour 12 Minute 0 Finally, [[http://apple.stackexchange.com/questions/217453/configure-launchd|you need to explicitly load it]]. $ launchctl load -w /Library/LaunchDaemons/com.dlma.tag_ip_address.plist ===== Software to Get ===== * [[https://ghostty.org/download|Ghostty]] and install your [[http://git.dlma.com/dotfiles.git/|dotfiles]]. * [[http://iterm2.com/|iTerm2]]. * Preferences -> Profiles -> Terminal -> uncheck "Save lines to scrollback in alternate screen mode" * Install Powerline Fonts per [[private:fonts]]. * [[http://www.delicious-monster.com/|Delicious Library]]: Keep track of my physical media. * Code Editing * [[https://code.visualstudio.com/|Visual Studio Code]] * [[http://developer.apple.com/tools/xcode/|XCode]] * Paint program * [[http://gimp.lisanet.de/Website/Download.html|GIMP]] (Can I find something powerful, free **and** user-friendly?) X11 is frustrating. * [[http://paintbrush.sourceforge.net/|PaintBrush]] * [[https://github.com/philippec/Pixen|Pixen]] * [[http://seashore.sourceforge.net/The_Seashore_Project/Download.html|SeaShore]] No levels adjusting. * [[http://www.rdsisemore.com/paintds|PaintDS]] No layers. * [[http://www.artrage.com/artrage-demos.html|ArtRage]] [[http://foreword.com/2011/05/6796/hack_os_x/|Danelope]] suggests these Image Editors in 2011: * http://gimpshop.com/ * http://pixelmator.com/ ===== Preferences I don't set anymore ===== * [[http://www.mikesel.info/show-hidden-files-mac-os-x-10-7-lion/|Show hidden files]] with defaults write com.apple.Finder AppleShowAllFiles YES; killall Finder * Configure [[http://mail.google.com/support/bin/answer.py?answer=81379|mail to use Gmail]]. * Cofigure [[http://www.google.com/support/calendar/bin/answer.py?answer=99358#ical|iCal to sync with Google Calendar]]. * System Preferences: * Keyboard * Command Key: Control Panel -> Keyboard -> Modifier Keys... -> swap Command and Control keys * Except that [[https://discussions.apple.com/thread/2793826?threadID=2793826&tstart=90|it doesn't persist past logging out]]. * [[http://lifehacker.com/5826055/make-your-keyboard-keys-repeat-properly-when-held-down-in-mac-os-x-lion|Make Your Keyboard Keys Repeat Properly When Held Down in Mac OS X Lion (macOS)]]. * [[http://quicksilver.en.softonic.com/mac|Quicksilver]]: Reach any program with a few keystrokes. (Eg., Control+space, M for Mail) ===== iOS Apps ===== Here are iPhone/iPod apps I really want to make. * [[wp>Sokoban|Sokoban]] * A [[http://build.last.fm/category/Scrobblers|Scrobbler]] ==== Sokoban ==== [[wp>Sokoban|Sokoban]]: Plenty already exist. What matters here is an intuitive (to me) user control. ==== Scrobbler ==== What matters here is the ability to scrobble what I've played to last.fm directly from my iPhone/iPod. ====== Prey ====== [[https://panel.preyproject.com/]] for when the device goes missing. (Or is stolen by a thief.) ====== NFS for macOS ====== On the server side get your user ID and group ID (id -u; id -g), and update /etc/exports with something like: /path/to/share 10.?.?.?(rw,sync,insecure,all_squash_anonuid=,anongid=) 10.?.?.? would be the IP of the Macintosh. (That'll have to be updated every time it changes.) For a Macintosh to connect, "insecure" was said to be needed. And "all_squash" was needed for the uid and gid to be set. Restart and check the NFS server with "sudo systemctl restart nfs-server.service; systemctl status nfs-server.service". Get the "hostname" for the server for the next bit on the client side. Call it jdoe-t3610. On the client side, you could manually mount the NFS volume with something like, "nfs://jdoe-t3610/path/to/share" Or better, configure automounter by adding a line to /etc/auto_master: /- auto_sandbox -rw And then make the file /etc/auto_sandbox /sandbox nfs://jdoe-t3610/path/to/share For the purpose of P4 client compatibility with the dev system, I use a symbolic link at root. $ sudo ln -s /sandbox/sandbox/stb/ /link_to_p4_root If you want your changes to take effect immediately, $ sudo automount -vc ====== Keywords ====== aps, todo