macOS의 기본 CapsLock 한영 전환은 특유의 입력 딜레이 때문에 빠른 타이핑 시 오타를 유발하곤 합니다. 오늘은 이 문제를 완벽하게 해결하여 딜레이 없는 쾌적한 입력 환경을 만드는 두 가지 방법을 소개합니다.

The default CapsLock language switching in macOS often causes typos during fast typing due to a subtle input delay. Today, I’ll introduce two methods to perfectly solve this issue and create a seamless, delay-free typing environment.


방법 1: Hammerspoon을 이용한 리매핑 (시각적 알림 포함) Method 1: Using Hammerspoon (With Visual Alerts)

Hammerspoon은 macOS의 시스템 자동화를 돕는 강력한 도구입니다. 이 방법은 CapsLock을 F18로 매핑함과 동시에, 화면 중앙에 현재 입력 소스 상태를 보여주는 시각적 피드백을 제공합니다.

Hammerspoon is a powerful tool for macOS automation. This method maps CapsLock to F18 while providing visual feedback that displays the current input status in the center of the screen.

1. 설치 및 준비 (Installation & Preparation)

Homebrew를 사용하여 설치하고, 리매핑 기능을 수행하는 foundation_remapping.lua 파일을 다운로드하여 ~/.hammerspoon/ 폴더에 저장합니다.

Install it using Homebrew and save the foundation_remapping.lua file in your ~/.hammerspoon/ directory.

brew install --cask hammerspoon

2. Config 설정 (Configuration)

Hammerspoon의 init.lua 파일에 아래 스크립트를 전체 복사하여 넣습니다.

Copy and paste the following script into your Hammerspoon init.lua file.

local inputSource = {
    english = "com.apple.keylayout.ABC",
    korean = "com.apple.inputmethod.Korean.2SetKorean",
}

local customStyle = hs.alert.defaultStyle

customStyle.fillColor = { white = 0, alpha = 0.25 }
customStyle.strokeColor = { alpha = 0 }

customStyle.textColor = { white = 0.75, alpha = 0.75 }
customStyle.textSize = 80

customStyle.fadeOutDuration = 0.75

function IM_alert()
    
    local current = hs.keycodes.currentSourceID()
    local language = nil
  
    if current == inputSource.korean then
      language = '  🇰🇷 가나다  '
    elseif current == inputSource.english then
      language = '  🇺🇸 ABC  '
    else
      language = current
    end
  
    if hs.keycodes.currentSourceID() == last_alerted_IM_ID then return end
  
    hs.alert.closeSpecific(last_IM_alert_uuid)
    last_IM_alert_uuid = hs.alert.show(language, customStyle, 0.1)
    last_alerted_IM_ID = hs.keycodes.currentSourceID()
end
  
hs.keycodes.inputSourceChanged(IM_alert)

local FRemap = require('foundation_remapping')
local remapper = FRemap.new()
remapper:remap('capslock', 'f18')
remapper:register()

방법 2: Native 리매핑 및 자동 실행 등록 (고급자용) Method 2: Native Remapping & LaunchAgent (For Advanced Users)

별도의 앱 설치 없이 macOS 내장 도구인 hidutil을 사용하는 방식입니다. 딜레이가 전혀 없으며, 시스템 레벨에서 실행되므로 매우 가볍습니다.

This method uses hidutil, a built-in macOS tool, without extra apps. It has zero delay and is very lightweight as it runs at the system level.

1. 사전 설정 (Prerequisites)

작업 전, 시스템 설정에서 기존의 CapsLock 기능을 꺼야 합니다. Before starting, disable the default CapsLock functionality in System Settings.

  • System Settings > Keyboard > Text Input > Edit: “Use the Caps Lock key to switch to and from ABC” -> Off
  • System Settings > Keyboard > Dictation: Change the shortcut to an unused combination (e.g., Ctrl+Opt+Cmd+Shift+D).

2. 터미널 커맨드 실행 (Terminal Commands)

아래 내용을 터미널에 한 번에 복사해서 입력하세요. 스크립트 생성과 자동 실행 등록이 동시에 진행됩니다.

Copy and paste the following block into your terminal. This will create the script and register it as a LaunchAgent.

mkdir -p "$HOME/bin" "$HOME/Library/LaunchAgents"

cat > "$HOME/bin/remap-keys.sh" <<'EOF'
#!/bin/sh
sleep 2
/usr/bin/hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x70000006D},{"HIDKeyboardModifierMappingSrc":0x7000000E7,"HIDKeyboardModifierMappingDst":0x700000039}]}'
EOF

chmod +x "$HOME/bin/remap-keys.sh"

cat > "$HOME/Library/LaunchAgents/com.tars.keyremap.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.tars.keyremap</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/sh</string>
        <string>$HOME/bin/remap-keys.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
EOF

launchctl bootstrap gui/$(id -u) "$HOME/Library/LaunchAgents/com.tars.keyremap.plist"

공통 마무리 설정 (Final Step) Final Step for Both Methods

어떤 방법을 선택했든, 마지막으로 Mac의 단축키 설정에서 실제 키를 지정해주어야 합니다.

Regardless of the method you chose, you must assign the key in the Mac’s shortcut settings.

  1. System Settings > Keyboard > Keyboard Shortcuts > Input Sources 이동 (Go to System Settings > Keyboard > Keyboard Shortcuts > Input Sources)
  2. ‘Select the previous input source’ (이전 입력 소스 선택) 체크 (Check ‘Select the previous input source’)
  3. 단축키 칸을 더블 클릭한 후 CapsLock 키를 입력 (Double-click the shortcut field and press the CapsLock key)
  4. 화면에 F18이 표시되면 성공! (If F18 appears, you’re all set!)

결론 Conclusion

시각적인 피드백과 알림창이 중요하다면 방법 1(Hammerspoon)을, 가장 깔끔하고 빠른 네이티브 성능을 원한다면 방법 2(Native 리매핑)를 추천합니다.

If visual feedback and alerts are important, I recommend Method 1 (Hammerspoon). For the cleanest and fastest native performance, Method 2 (Native Remapping) is the way to go.