> For the complete documentation index, see [llms.txt](https://kajirikajiri.gitbook.io/gitbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kajirikajiri.gitbook.io/gitbook/gh-open-not-working-with-wsl2.md).

# gh-open not working with wsl2

```
# pip を使えるようにする
sudo apt-get install python3-pip
pip3 install --user --upgrade pip
echo "export PATH=\"${HOME}/.local/bin:$PATH\"" >>"${HOME}"/.zshrc

# pipでxdg-open-wslをinstall
pip install --user git+https://github.com/cpbotha/xdg-open-wsl.git

# xdg-openの生存確認 & 動作確認
which xdg-open
xdg-open http://www.google.com
```

平和がおとずれた

## 過程

{% embed url="<https://github.com/typester/gh-open/blob/master/main.go>" %}
まずは、gh-openのソースを確認
{% endembed %}

{% embed url="<https://github.com/skratchdot/open-golang/blob/master/open/open.go>" %}
gh-openのソースコード中に記載のあった、open-golangのソースコードを確認
{% endembed %}

{% embed url="<https://github.com/pwnall/node-open>" %}
open-golangのソースコード中に記載のあった、node-openを確認
{% endembed %}

{% embed url="<https://www.reddit.com/r/bashonubuntuonwindows/comments/fj0jpf/xdgopenwsl_a_wslspecific_xdgopen_replacement_to/>" %}
node-openのコメントから、win32でなく、darwinでもないため、otherのxdg-openが必要であると判断したが、xdg-openコマンドなかった
{% endembed %}

{% embed url="<https://github.com/cpbotha/xdg-open-wsl>" %}
redditのコメントから、これをインストールすると判断
{% endembed %}

{% embed url="<https://algorithm.joho.info/unix/wsl-ubuntu-python-pip/>" %}
pipがないのでinstall
{% endembed %}

{% embed url="<https://github.com/microsoft/WSL/issues/4020>" %}
pipが使えないので、環境変数だろうとあたりをつけて、調べて、コメントを参照
{% endembed %}

{% embed url="<https://github.com/cpbotha/xdg-open-wsl>" %}
pipが使えるようになったのでinstall。動作確認成功
{% endembed %}

番外編

darwinてなんや？？(なんとなくわかってる)

gh-openに渡してる引数が悪いのか？(そんなことなかった)

open動かないんだけど。。引数か？(darwinのコマンドだから、wsl2では動かない)
