👑 Premium Sign in Sign up

Language lab · Beginner → Dev

🍏 macOS for developers

Concept → trace → write code → run tests → explain why → improve → mini-project. Start in the browser if you like; set up your own computer when you are ready.

💻 Runs on your computerOfficial download & docs ↗

📖 Topics with real code (12)

Every verified output below was produced by running the code with guided (run on your own machine or account) on 6 Nov 2026. Open a topic to edit the code and run it on your own computer.

🌱 Beginner (3)

Terminal and zsh

macOS uses zsh by default. Open Terminal (Applications → Utilities). Many Linux commands work the same; some come from BSD and take slightly different options.

echo $SHELL
sw_vers                 # macOS version and build
uname -m                # arm64 on Apple silicon, x86_64 on Intel
system_profiler SPHardwareDataType | grep -E 'Model Name|Chip|Memory'

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Homebrew package manager

Homebrew installs developer tools (git, python, node…). brew install adds a package, brew upgrade updates, brew list shows what is installed.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install git python node
brew list --versions | head
brew upgrade
brew doctor

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Finder and the command line together

open launches files and apps from the terminal; pbcopy and pbpaste use the clipboard; mdfind searches like Spotlight.

open .                              # this folder in Finder
open -a "TextEdit" notes.txt
echo "copied from terminal" | pbcopy
pbpaste
mdfind -name "invoice" | head

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

🌿 Intermediate (5)

Permissions, quarantine and Gatekeeper

Downloaded apps get a quarantine flag; Gatekeeper checks their signature. xattr shows extended attributes; chmod works as on Linux.

ls -l@ ~/Downloads/tool.zip
xattr -l ~/Downloads/tool.zip
spctl --assess --verbose /Applications/Safari.app
codesign -dv /Applications/Safari.app 2>&1 | grep Authority | head -2

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Processes and Activity Monitor

ps and top work as on Linux; Activity Monitor is the graphical version. kill stops a process; killall stops by name.

ps aux | sort -nrk 3 | head -5        # top CPU users
top -l 1 -n 5 -o cpu | tail -6
pgrep -l Safari
killall -TERM "Preview"

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

launchd: services and scheduled jobs

macOS starts background jobs with launchd (instead of systemd or cron). A job is a .plist file in ~/Library/LaunchAgents; launchctl loads it.

cat > ~/Library/LaunchAgents/com.gayagnan.backup.plist <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0"><dict>
  <key>Label</key><string>com.gayagnan.backup</string>
  <key>ProgramArguments</key><array><string>/Users/me/bin/backup.sh</string></array>
  <key>StartCalendarInterval</key><dict><key>Hour</key><integer>2</integer></dict>
</dict></plist>
EOF
launchctl load ~/Library/LaunchAgents/com.gayagnan.backup.plist
launchctl list | grep gayagnan

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

defaults: app and system settings

Settings are stored in plist "domains". defaults read and write change them from the terminal; some need the app or Finder restarted.

defaults read com.apple.finder AppleShowAllFiles
defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder
defaults write com.apple.screencapture location ~/Pictures/Screenshots
defaults read -g AppleInterfaceStyle   # prints Dark in dark mode

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Networking

networksetup configures interfaces; scutil shows DNS; ifconfig and ping work as on Linux.

networksetup -listallhardwareports
ipconfig getifaddr en0
scutil --dns | grep nameserver | head -3
ping -c 3 gayagnan.com
curl -sI https://gayagnan.com | head -1

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

🌳 Advanced (4)

Disks with diskutil

diskutil lists disks, checks and repairs volumes, and manages APFS containers. Erase commands destroy data: read before you run.

diskutil list
diskutil info / | grep -E 'File System|Free Space|Encrypted'
diskutil apfs list | head -20
df -h /

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Security: FileVault, keychain and SIP

FileVault encrypts the disk; the keychain stores passwords and certificates; System Integrity Protection guards system files.

fdesetup status
csrutil status
security find-generic-password -s "Wi-Fi" -a "MyNetwork" -w   # asks for permission
security list-keychains

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Xcode command-line tools and swift

xcode-select installs compilers (clang, git, make). swift and swiftc compile Swift; xcrun finds the right tool for each SDK.

xcode-select --install
clang --version | head -1
xcrun --show-sdk-path
echo 'print("Hello from Swift on macOS")' > hello.swift && swift hello.swift

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

Time Machine and backups

tmutil controls Time Machine: start a backup, list snapshots, restore files. Local APFS snapshots allow quick rollbacks.

tmutil status
tmutil startbackup --auto
tmutil listbackups | tail -3
tmutil listlocalsnapshots /

🖥️ Run this on a Mac. The output depends on your machine, so no sample output is shown.

💻 Terminal on my computer

Like a cloud shell, but on your own laptop: install compilers and run real commands from this page through the free GayaGnan agent. It asks you before connecting, installing or running anything.

🛠️ Set up and verify

  1. Install
    use a Mac
    Terminal is built in (Applications → Utilities)
    use a Mac
  2. Editor: Visual Studio Code with Xcode command-line tools, Homebrew.
  3. Create check.sh
    echo "Hello, GayaGnan!"; sw_vers -productVersion
  4. Run it and check the version
    check.sh
    sw_vers
  5. Health check: paste what your terminal printed.

Install one language at a time. These commands only install or print versions; nothing here deletes files. Versions change: check the official page and note the version you installed.

🧭 The 14-lab path

  • 00 · Setup and verify — install the runtime and editor, run hello world, print the version, fix PATH
  • 01 · Syntax and trace — follow each line and the value of every variable
  • 02 · Logic — conditionals and decision trees
  • 03 · Loops — trace tables and loop challenges
  • 04 · Functions — break problems down and test each piece
  • 05 · Data structures — lists, maps, stacks, queues and trees you can see
  • 06 · Debugging — bug cases with a hint ladder
  • 07 · Algorithms — search, sort and Big-O comparison
  • 08 · Files and data — read and write fixture files
  • 09 · API or database — talk to a mock API or a sandbox database
  • 10 · Testing — write tests and read failing assertions
  • 11 · Security — secure coding and dependency hygiene for this language
  • 12 · Project — one portfolio mini-project
  • 13 · Assessment — quiz, coding test, rubric and an explain-your-answer prompt

📚 Modules

  1. zsh
  2. Homebrew
  3. Finder and terminal
  4. Gatekeeper
  5. processes
  6. launchd
  7. defaults
  8. networking
  9. diskutil
  10. FileVault and keychain
  11. Xcode tools
  12. Time Machine

🏗️ Mini-projects

  • Developer machine setup script
  • Automated backup with launchd

Projects use synthetic data only.