LoginSignup
4
1

sshfs + osxfuse で Mac にサーバ上のディレクトリをマウント

Last updated at Posted at 2020-08-09

sshfs + osxfuse で Mac にサーバ上のディレクトリをマウント

はじめに

仕事をしていると往々にしてサーバ上のファイルを直接いじりたい場面がある。
そんなときに便利なのが、 sshfs です。
サーバのディレクトリをローカルにマウントできるので、自分の好きなエディタでいじることができます。
ちなみに osxfuse は Mac のファイルシステムを操作するためのライブラリです。

環境

sshfs+osxfuse.png

インストール

brew cask install osxfuse
brew install sshfs

マウント

# sshfs [ユーザー名]@[ホスト名]:[ディレクトリ] [ローカルのマウントしたい場所]
sshfs takiguchi-yu@test-server001:/home/takiguchi-yu/app/src/ ~/Desktop/hogehoge/

アンマウント

diskutil unmount force ~/Desktop/hogehoge/

最後に

パソコンを閉じるとマウントが切れてしまうため、自動化したい。
マウントが切れたときは、アンマウント→マウントし直すと直ります。

4
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
4
1