0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

zedをbuildして使う (open source versionを利用する)

0
Posted at

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
~/.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 .

のように起動できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?