環境
macOS High Sierra
バージョン 10.13.6
MAMP: Version 5.2 (351)
動機
MAMPを使っていて、termialでcd
コマンドでhtdocs/
ディレクトリに移りたい事がよくあります。
デスクトップにhtdocs/
へのショートカットを作ってあるのでfinderからhtdocs/
へ移ることは簡単なのですが、terminalの場合は毎回
bash
1cd /Applications/MAMP/htdocs/
と打たないといけません。ちょっとした手間です。
デスクトップに作ったhtdocs
はシンボリックリンクなので、cd ~/Desktop/htdocs
と打つと
bash
1bash: cd: htdocs: Not a directory
とはじかれます。
ググっても大抵「ディレクトリへのハードリンクは出来ません」と書いてあります。
ところが色々探しているうちにhln
というコマンドをインストールすれば可能だという話にたどり着きました。
(hln
に関してはこの質問の下の方に「追記」としてURLを載せてあります。)
これが出来れば更に短く
bash
1cd ~/htdocs/
だけでhtdocs
にたどり着けます。
ということでhln
をインストールしてみたのですが、思うように行っていません。
hln のインストール
terminalで以下のコマンドを打ってhln
をインストールしました。
bash
1~/hln_test brew install hardlink-osx 2==> Downloading https://homebrew.bintray.com/bottles/hardlink-osx-0.1.1.high_sierra.bottle.tar.gz 3Already downloaded: /Users/****/Library/Caches/Homebrew/downloads/3b03a9de6c59e921a73bf4bdf7db3da8d69973288ae0fd7ca75e69b6b9a72741--hardlink-osx-0.1.1.high_sierra.bottle.tar.gz 4==> Pouring hardlink-osx-0.1.1.high_sierra.bottle.tar.gz 5==> Caveats 6Hardlinks can not be created under the same directory root. If you try to 7`hln source directory` to target directory under the same root you will get an error! 8 9Also, remember the binary is named `hln` due to a naming conflict. 10==> Summary 11???? /usr/local/Cellar/hardlink-osx/0.1.1: 4 files, 12.2KB 12~/hln_test
hln の実行
以下のようにhln
コマンドを叩いてるのですが、「Operation not permitted」と怒られてしまいます。
bash
1~/hln_test tree 2. 3├── dirA 4│ └── tmp.txt 5└── dirB 6 72 directories, 1 file 8~/hln_test hln dirA dirB/dirA 9hln: Operation not permitted 10~/hln_test
#質問
hln
のインストールは上手く行っているように見えます。
インストール中に言われている
「hln source directory
to target directory under the same root you will get an error!」
もソースディレクトリは~/hln_test/dirA
でターゲットディレクトリは~/hln_test/dirB/dirA
なので同じルートデェレクトリでなく、問題ないと思います。
何がいけないのでしょう?
hln
にこだわらなくても別の解決方法があれば教えてください。
ちなみにln -F
も試してみたのですが
bash
1~/hln_test ln -F dirA dirB/dirA 2ln: dirA: Is a directory 3~/hln_test
でした。
追記 2019.3.19(tue) 20:26
hln
に関する出典は
https://recordnotfound.com/hardlink-selkhateeb-64697
にあります。
こちらにこのコマンドの動機・名前について・必要条件・インストール・使い方・制限などが英語ですが説明されています。参考になさってください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/21 09:29
2019/03/21 10:06 編集
2019/03/21 20:01
2019/03/21 23:26
2019/04/04 06:50