Skip to content

Instantly share code, notes, and snippets.

@SanMurakami
Created June 5, 2025 15:21
Show Gist options
  • Select an option

  • Save SanMurakami/213428dc56205e661e187a6184dcd236 to your computer and use it in GitHub Desktop.

Select an option

Save SanMurakami/213428dc56205e661e187a6184dcd236 to your computer and use it in GitHub Desktop.
macOSお仕事とプライベートでCursorエディタのアカウントを簡単に切り替えたい人向け
#!/bin/bash
############################################################
# 設定部分(必要に応じて書き換えてください)
############################################################
SUFFIX1="Private"
SUFFIX2="Work"
# 初回起動時など、接尾語ディレクトリが何も無い場合に使うデフォルト接尾語
DEFAULT_SUFFIX="$SUFFIX1"
############################################################
BASE_DIR="$HOME/Library/Application Support"
APP_DIR="${BASE_DIR}/Cursor"
DIR1="${BASE_DIR}/Cursor_${SUFFIX1}"
DIR2="${BASE_DIR}/Cursor_${SUFFIX2}"
killall -9 "Cursor" 2>/dev/null
sleep 1
if [ -d "$DIR1" ]; then
if [ -d "$APP_DIR" ]; then
mv "$APP_DIR" "$DIR2"
fi
mv "$DIR1" "$APP_DIR"
elif [ -d "$DIR2" ]; then
if [ -d "$APP_DIR" ]; then
mv "$APP_DIR" "$DIR1"
fi
mv "$DIR2" "$APP_DIR"
else
mv "$APP_DIR" "${BASE_DIR}/Cursor_${DEFAULT_SUFFIX}"
open -a "Cursor"
exit 0
fi
open -a "Cursor"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment