Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active February 2, 2025 07:16
Show Gist options
  • Select an option

  • Save wilmoore/17a2dadef66f266625a4cc9f660a8802 to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/17a2dadef66f266625a4cc9f660a8802 to your computer and use it in GitHub Desktop.
Software Engineering :: Operating Systems :: macOS :: Developer Setup :: mac.dev

Software Engineering :: Operating Systems :: macOS :: Developer Setup :: mac.dev

⪼ Made with 💜 by Polyglot.

domain brainstorming
  • mac.dev
  • macbook.dev
  • macos.dev
references
related
xcode

Summary

What is the state-of-the-art way to setup a new Mac for software development? How do I keep my Mac software up-to-date? How do I get the most out of this non-trivial investment? If I need to setup a new Mac; how do I guarantee that I'll be as efficient on the new Mac as I was on the previous Mac?

About

The missing Mac Software Developer's Manual (MacBook Developer Setup Guide) Something that took me a really long time to get right as a software engineer is my personal development machine setup. There are several things that need to be in place in order to get this right:

  1. backing-up installed applications (command-line applications & Native Mac Applications)
  2. re-storing installed applications (command-line applications & Native Mac Applications)
  3. backing-up system and application configuration
  4. re-storing system and application configuration
  5. Operating system ergonomics (keyboard setup, finder configuration, ...)

Sections

1. Global System Configuration

Open Safari and navigate to "google.com"; then press Option + Command + c to open the developer console. You'll likely see some janky logs. To clear those out, you can press the Control + l key combination; however, the "control" key is in such an inconvenient place on the keyboard, especially for someone who uses the control key so often. It turns out, in MacOS it is easy to remap keys so they function as other keys. I rarely yell on the internet, so, I like to remap the "caps lock" key such that it acts as if it were the "control" key. This can be done on the command-line with the hidutil program. Now, going forward, when I'm in the developer console and I want to clear the logs, I can press the caps lock + l and it will function as if I had pressed control + l.

related
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}'
before pressing control + l

after pressing control + l

hidutil property --set '{ "UserKeyMapping": [] }'

persist remapping keys

cat > ~/Library/LaunchAgents/com.local.KeyRemapping.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.local.KeyRemapping</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/hidutil</string>
        <string>property</string>
        <string>--set</string>
        <string>{"UserKeyMapping":[
          {
            "HIDKeyboardModifierMappingSrc": 0x700000039,
            "HIDKeyboardModifierMappingDst": 0x7000000E0
          }
        ]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
EOF
...
less ~/Library/LaunchAgents/com.local.KeyRemapping.plist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment