# My macOS tweaks coming from Ubuntu > On June 2023, I've decided to abandon "desktop" Linux. I can't bear having to work around everything all the time, not even counting the tons of problems that occur whenever I do a major version upgrade (e.g., when I upgraded from 21.10 to 22.04, my PPAs broken obviously, and also I lost all the hack I had made to the `/etc` to work around problems). I am officially back to macOS starting 26 June 2023. I'll still use my Linux workstation remotely over Mosh, but not as a desktop environment. To smoothen the transition, I use the following hacks on macOS: 1. **Linear Mouse** since I can't stand macOS' mouse acceleration and also to fix my mouse wheel's direction. My config: | Setting | Value | |---------|-------| | Pointer -> Pointer acceleration | 0.5 | | Pointer -> Pointer speed | 0.1717 | | Scrolling -> Scrolling mode | By Lines | | Scrolling -> Distance | 2 | 2. **Magnet** to be able to move windows around and move them to 1/2 of the display. 3. **AltTab** to switch between windows instead cmd+tab's application switching. 4. **Audio Switch** to make sure my bluetooth headset's microphone **never get used** (any wired mic close enough to the mouth is better than a bluetooth mic; the macbook pro's mics are good for that matter). 5. **MenuMeters** to see the network activity in the top menu bar. 6. **Screenshots** tweaks: ```bash defaults write com.apple.screencapture location ~/Downloads defaults write com.apple.screencapture disable-shadow -bool true defaults write com.apple.screencapture show-thumbnail -bool false # MacOS trick: change the screenshot generated name. # Source: https://apple.stackexchange.com/questions/251385 # # ⚠️ You can't change the name of generated screenshots! # defaults write com.apple.screencapture "include-date" 0 defaults write com.apple.screencapture name screenshot-"$(date +%Y-%m-%d)-$(date +%H%M)" ``` 7. **Font in iTerm2:** ```bash brew install font-hack-nerd-font ``` 8. **Play/pause in YouTube Music:** To fix the Play/Pause/Forward/Backward buttons in YouTube Music's Electron app, make sure that the Media flag is enabled in chrome://flags. Also, don't try to disable Apple Music app from launching on "Play", otherwise you will also disable the media keys entirely! 9. **iTerm2** writes weird characters on click after an ssh session with tmux unexpectedly ended: ```console $ 0;37;9M0;37;9m0;24;6M0;24;6m ``` That's because "mouse reporting" is still enabled for the current shell session. To disable mouse reporting, run: ```bash printf '\e[?1000l' # disables mouse reporting ``` To know more: https://superuser.com/questions/802698/disable-mouse-reporting-in-a-terminal-session-after-tmux-exits-unexpectedly 10. ctrl+space doesn't work in VSCode: disable system shortcut for "Previous input source". 11. Zsh is borked (e.g., up arrow no longer filters previous commands starting with what's in your prompt): ```bash rm -rf ~/.antigen ``` 10. Moving a window without any borders. I like having no menu bar at all in Ghostty. Turns out there is a way to move the window by cmd+ctrl+clicking anywhere on the window ([source](https://mmazzarolo.com/blog/2022-04-16-drag-window-by-clicking-anywhere-on-macos/)): ```bash defaults write -g NSWindowShouldDragOnGesture -bool true ``` (requires restarting the apps before this setting takes effect) ## Not specific to macOS To launch VSCode Insiders from the command-line using the `code` command rather than the longer version `code-insiders`: ```bash sudo ln -sf $(which code-insiders) $(which code) ``` ## For recording screencasts and videos - Teleprompter.app - KeyCastr ## Option+arrow doesn't work in VSCode ```bash # In don't want to rely on OMZ anymore. But I love this word-to-word jump on # ctrl-left-arrow and ctrl-right-arrow (instead of jumping to the next space, # it jumps to the next word). # https://coderwall.com/p/a8uxma/zsh-iterm2-osx-shortcuts # # This is for iTerm2: bindkey "\eb" backward-word bindkey "\ef" forward-word # For VSCode. I ran "cat | hexdump -C" to know what key was sent when pressing # alt+left.` bindkey "\e[1;3D" backward-word bindkey "\e[1;3C" forward-word ``` ## git-credential-osxkeychain keeps asking for a password If you are using `gh`, you don't want to store the github token in your keychain; if you see this message, it means it's the wrong auth method being used: ![git-credential-osxkeychain](https://hackmd.io/_uploads/rk3cYbrSlg.png) All you have to do is to remove "github.com" internet passwords that are causing this: ```bash security delete-internet-password -s github.com ``` ## Shift+enter not working in iTerm2 (Claude Code) If `/terminal-setup` doesn’t work in iTerm2, try the setup below: - Open iTerm2 → Settings (⌘ + ,). - Go to Profiles → Keys. - In the Key Mappings section, click the “+” button. - Record the keyboard shortcut: - Click the Keyboard Shortcut field. - Press Shift + Enter. It should display as "⇧Return↩". - Configure the action: - Set Action to Send Hex Code - In the text field, enter: 0x1b 0x0d - Click OK - It should now work, no need to restart. ![fix-shift-enter-iterm-claude-2](https://hackmd.io/_uploads/HyWOmNww-x.png) ![fix-shift-enter-iterm-claude-1](https://hackmd.io/_uploads/HkZdmVPDZe.png)