Clash を使い始めるには、ソースからビルドするか、ビルド済みのバイナリをダウンロードします。
ビルド済みバイナリを使用する
Clash のコアバイナリは、こちらからダウンロードできます:Clash Premium に関する説明
ソースからビルドする
Golang 1.19+ を使って、端末上で Clash をビルドできます:
shell
$ go install github.com/Dreamacro/clash@latest
go: downloading github.com/Dreamacro/clash v1.15.1バイナリは $GOPATH/bin ディレクトリにビルドされます:
shell
$ $GOPATH/bin/clash -v
Clash unknown version darwin arm64 with go1.20.3 unknown timeクロスプラットフォーム/OS 向けのビルド
Golang はクロスコンパイルをサポートしているため、異なるアーキテクチャやオペレーティングシステム向けに Clash をビルドできます。make を使えば、たとえば次のように簡単にビルドできます:
shell
$ git clone --depth 1 https://github.com/Dreamacro/clash
Cloning into 'clash'...
remote: Enumerating objects: 359, done.
remote: Counting objects: 100% (359/359), done.
remote: Compressing objects: 100% (325/325), done.
remote: Total 359 (delta 25), reused 232 (delta 17), pack-reused 0
Receiving objects: 100% (359/359), 248.99 KiB | 1.63 MiB/s, done.
Resolving deltas: 100% (25/25), done.
$ cd clash && make darwin-arm64
fatal: No names found, cannot describe anything.
GOARCH=arm64 GOOS=darwin CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=unknown version" -X "github.com/Dreamacro/clash/constant.BuildTime=Mon May 8 16:47:10 UTC 2023" -w -s -buildid=' -o bin/clash-darwin-arm64
$ file bin/clash-darwin-arm64
bin/clash-darwin-arm64: Mach-O 64-bit executable arm64その他のビルドターゲットについては、当サイトのクロスコンパイル手順 を参照してください。
