2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】Mac コマンド集

Last updated at Posted at 2025-06-01

Qiitaの記事で見かけたコマンドの備忘録

openコマンドの使い方

デフォルトのアプリケーションでファイルを開く
open file.txt
カレントディレクトリの特定の拡張子のファイルを全てデフォルトのアプリケーションで開く
open *.txt
特定のアプリケーションを開く
open -a "Safari"
特定のアプリケーションでファイルを開く
open -a "Safari" image.gif
バンドル識別子に基づいてアプリケーションを開く
open -b com.domain.application
アプリケーションの新しいインスタンスを開く
open -n -b com.domain.application
Finderでディレクトリを開く
open path/to/dir
Finderでファイルを開く
open -R path/to/file

コマンドでスクリーンショットの保存先を変更する方法

defaults write com.apple.screencapture location 保存先パス
保存先を確認する
defaults read com.apple.screencapture location

コマンドでsleepを抑止

スクリーンショットの影をなくす方法

defaults write com.apple.screencapture disable-shadow -bool true && killall SystemUIServer
戻す
defaults write com.apple.screencapture disable-shadow -bool false && killall SystemUIServer

コマンドでOSをアップデートする方法

利用可能なアップデートの一覧
softwareupdate -l
利用可能なすべてのアップデートをインストール
sudo softwareupdate -i -a
特定のアップデートをインストール
sudo softwareupdate -i "アップデート名"

ネットワークドライブに.DS_Storeが作成されないようにする方法

defaults write com.apple.desktopservies DSDontWriteNetworkStores -bool true
USBドライブに.DS_Storeが作成されなくする
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

コマンドでWi-Fiのオン・オフを切り替える方法

Wi-Fiがオンにする
networksetup -setairportpower Wi-Fi on
Wi-Fiをオフにする
networksetup -setairportpower Wi-Fi off

特定のインタフェースのみ(例;en1)
networksetup -setairportpower en1 off|on

特定のファイルやフォルダを非表示にする方法

chflags hidden ファイルやフォルダのパス
再度表示するには以下のコマンド
chflags nohidden ファイルやフォルダのパス

コマンドでスリープさせる方法

pmset sleepnow
ディスプレイのみスリープさせる
pmset displaysleepnow

シンボリックリンクを作成・削除する方法

作成
ln -s /path/to/original /path/to/link
削除方法
unlink /path/to/link

コマンドでデスクトップ上のアイコンを非表示にする方法

非表示にする
defaults write com.apple.finder CreateDesktop false && killall Finder
再表示する
defaults write com.apple.finder CreateDesktop true && killall Finder
現在の設定値を確認する
defaults read com.apple.finder CreateDesktop
#結果がfalseであれば非表示、trueなら表示

Macのターミナルでクリップボードを扱うコマンド

クリップボードへコマンド出力をコピー
echo "Hello, World!" | pbcopy
クリップボードの内容を出力
pbpaste > output.txt

音量を変更する方法

ミュート
osascript -e "set Volume 0"
最大音量
osascript -e "set Volume 10"

次のコマンドで得られる現在の設定音量は、0〜100

#osascript -e 'get volume settings'
osascript -e 'set ovol to output volume of (get volume settings)'

音量が 0〜100 の場合の設定コマンド

osascript -e "set volume output volume 0" #ミュート
osascript -e "set volume output volume 100" #最大音量

でも、10倍ではない、という不思議な仕様

% osascript -e "set Volume 0"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
0

% osascript -e "set Volume 1"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
14

% osascript -e "set Volume 2"
% osascript -e 'set ovol to output volume of (get volume settings)'
29

% osascript -e "set Volume 3"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
43

% osascript -e "set Volume 4"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
57

% osascript -e "set Volume 5"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
71

% osascript -e "set Volume 6"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
86

% osascript -e "set Volume 7"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
100

% osascript -e "set Volume 8"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
100

% osascript -e "set Volume 9"                                      
% osascript -e 'set ovol to output volume of (get volume settings)'
100

確かに、Volume 7以上は同じ音量に聞こえる気がします

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?