# 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では動かない)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kajirikajiri.gitbook.io/gitbook/gh-open-not-working-with-wsl2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
