Abstract
brew install zedは公式頒布のimageになるようです。
厳密には、OSS版とは異なるとのこと。
(OSS版は、editor:GPL3.0, server:AGPL-3.0, UI framework: Apache 2.0)
というわけで、OSS版を使うために、自前でbuildして見るという話です。
build
cd ~/work
git clone https://github.com/zed-industries/zed.git
cd zed
- Install rust (See https://rust-lang.org/tools/install/)
- Install xcode (
xcode-select --install) brew install cmake
~/.zprofile
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$(xcrun --show-sdk-path)"
source ~/.zprofile-
xcodebuild -downloadComponent MetalToolchain
(これ入れないとbuild失敗します) cargo run --release
すると、
~/work/zed/target/release/zedのバイナリーができます。
App launcherに登録
上でbuildされたzedを起動するだけだと、毎回shellが立ち上がってうざいです。
mkdir -p ~/Applications/Zed.app/Contents/MacOS
cp ~/work/zed/target/release/zed ~/Applications/Zed.app/Contents/MacOS
vim ~/Applications/Zed.app/Contents/Info.plist
~/Applications/Zed.app/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Zed</string>
<key>CFBundleDisplayName</key>
<string>Zed</string>
<key>CFBundleIdentifier</key>
<string>dev.zed.Zed</string>
<key>CFBundleVersion</key>
<string>0.0.0</string>
<key>CFBundleShortVersionString</key>
<string>OSS</string>
<key>CFBundleExecutable</key>
<string>zed</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>LSMinimumSystemVersion</key>
<string>12.0</string>
<key>com.apple.security.app-sandbox</key>
<false/>
</dict>
</plist>
Iconを作成する
1024x1024のAppIcon.pngを作成する。(alpha透過も推奨)
(https://github.com/zed-industries/zed/blob/main/assets/images/zed_logo.svg を参考に。browserでsvgは開けます。参考に。previewなどで透過.pngを作成できます)
mkdir AppIcon.iconset
sips -z 16 16 AppIcon.png --out AppIcon.iconset/icon_16x16.png
sips -z 32 32 AppIcon.png --out AppIcon.iconset/icon_16x16@2x.png
sips -z 32 32 AppIcon.png --out AppIcon.iconset/icon_32x32.png
sips -z 64 64 AppIcon.png --out AppIcon.iconset/icon_32x32@2x.png
sips -z 128 128 AppIcon.png --out AppIcon.iconset/icon_128x128.png
sips -z 256 256 AppIcon.png --out AppIcon.iconset/icon_128x128@2x.png
sips -z 256 256 AppIcon.png --out AppIcon.iconset/icon_256x256.png
sips -z 512 512 AppIcon.png --out AppIcon.iconset/icon_256x256@2x.png
sips -z 512 512 AppIcon.png --out AppIcon.iconset/icon_512x512.png
sips -z 1024 1024 AppIcon.png --out AppIcon.iconset/icon_512x512@2x.png
iconutil -c icns AppIcon.iconset
mkdir -p ~/Applications/Zed.app/Contents/Resources
mv AppIcon.icns ~/Applications/Zed.app/Contents/Resources/
touch ~/Applications/Zed.app
killall Dock
shellからの起動
#!/bin/zsh
open -a ~/Applications/Zed.app $1 $2 $3 $4 $5 $6 $7 $8 $9
chmod +x ~/bin/zed
で、
cd ~/work/zed
zed .
のように起動できます。