diff --git a/.github/workflows/gen_macos_tag.yml b/.github/workflows/gen_macos_tag.yml index f3a3b57e1..aa6e611ab 100644 --- a/.github/workflows/gen_macos_tag.yml +++ b/.github/workflows/gen_macos_tag.yml @@ -100,7 +100,7 @@ jobs: shell: bash run: | export MACOSX_DEPLOYMENT_TARGET=10.9 - cp wezterm.rb homebrew-wezterm/Formula/wezterm.rb + cp wezterm.rb homebrew-wezterm/Casks/wezterm.rb - name: "Commit homebrew tap changes" diff --git a/ci/generate-workflows.py b/ci/generate-workflows.py index cbdfcc201..ace93023d 100755 --- a/ci/generate-workflows.py +++ b/ci/generate-workflows.py @@ -369,7 +369,7 @@ cargo build --all --release""", ), RunStep( "Update homebrew tap formula", - "cp wezterm.rb homebrew-wezterm/Formula/wezterm.rb", + "cp wezterm.rb homebrew-wezterm/Casks/wezterm.rb", ), ActionStep( "Commit homebrew tap changes", diff --git a/ci/wezterm-homebrew-macos.rb.template b/ci/wezterm-homebrew-macos.rb.template index c1511e616..544a00a82 100644 --- a/ci/wezterm-homebrew-macos.rb.template +++ b/ci/wezterm-homebrew-macos.rb.template @@ -2,24 +2,51 @@ # updated from: # https://github.com/wez/wezterm/blob/main/ci/wezterm-homebrew-macos.rb.template # by automation in the wezterm repo. +# vim:ft=ruby: +cask "wezterm" do + version "@TAG@" + sha256 "@SHA256@" -class Wezterm < Formula + url "https://github.com/wez/wezterm/releases/download/#{version}/WezTerm-macos-#{version}.zip" + name "WezTerm" desc "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust" homepage "https://wezfurlong.org/wezterm/" - url "https://github.com/wez/wezterm/releases/download/@TAG@/WezTerm-macos-@TAG@.zip" - sha256 "@SHA256@" - head "https://github.com/wez/wezterm/releases/download/nightly/WezTerm-macos-nightly.zip" - def install - prefix.install "WezTerm.app" - bindir = "#{prefix}/WezTerm.app" - macosdir = "#{bindir}/Contents/MacOS" - if File.directory?(macosdir) then - bindir = macosdir + conflicts_with cask: "wez/wezterm/wezterm-nightly" + + # Unclear what the minimal OS version is + # depends_on macos: ">= :sierra" + + app "WezTerm.app" + [ + "wezterm", + "wezterm-gui", + "wezterm-mux-server", + "strip-ansi-escapes" + ].each do |tool| + binary "#{appdir}/WezTerm.app/Contents/MacOS/#{tool}" + end + + preflight do + # Move "WezTerm-macos-#{version}/WezTerm.app" out of the subfolder + staged_subfolder = staged_path.glob(["WezTerm-*", "wezterm-*"]).first + if staged_subfolder + FileUtils.mv(staged_subfolder/"WezTerm.app", staged_path) + FileUtils.rm_rf(staged_subfolder) end - ["wezterm", "wezterm-gui", "wezterm-mux-server", "strip-ansi-escapes"].each { |tool| - bin.write_exec_script "#{bindir}/#{tool}" - } + end + + zap trash: [ + "~/Library/Saved Application State/com.github.wez.wezterm.savedState", + ] + + def caveats; <<~EOS + Cask #{token} related executables like 'wezterm', 'wezterm-gui', + 'wezterm-mux-server', are linked into + /usr/local/bin/ for x86 Mac, + /opt/homebrew/bin/ for M1 Mac. + + Removal of them is ensured by 'brew uninstall --cask #{token}'. + EOS end end - diff --git a/docs/changelog.md b/docs/changelog.md index b4f8eac7d..bbc002927 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -23,6 +23,7 @@ As features stabilize some brief notes about them will accumulate here. * Improved: messaging around [exit_behavior](https://wezfurlong.org/wezterm/config/lua/config/exit_behavior.html) * Fixed: errors loading custom color schemes are now logged to the error log [#794](https://github.com/wez/wezterm/issues/794) * Fixed: OSC 7 (current working directory) now works with paths that contain spaces and other special characters. Thanks to [@Arvedui](https://github.com/Arvedui)! [#799](https://github.com/wez/wezterm/pull/799) +* Changed: the homebrew tap is now a Cask that installs to the /Applications directory on macOS. Thanks to [@laggardkernel](https://github.com/laggardkernel)! ### 20210502-154244-3f7122cb diff --git a/docs/install/macos.markdown b/docs/install/macos.markdown index 4079a12ae..bd2342e06 100644 --- a/docs/install/macos.markdown +++ b/docs/install/macos.markdown @@ -22,21 +22,21 @@ WezTerm is available for [brew](https://brew.sh/) users in a tap: ```bash $ brew tap wez/wezterm -$ brew install wezterm +$ brew install --cask wezterm --no-quarantine ``` -If you'd like to use a nightly build you can perform a head install: +If you'd like to use a nightly build: ```bash -$ brew install --HEAD wezterm +$ brew install --cask wezterm-nightly --no-quarantine ``` to upgrade to a newer nightly, it is simplest to remove then install: ```bash -$ brew rm wezterm -$ brew install --HEAD wezterm +$ brew rm --cask wezterm-nightly +$ brew upgrade --cask wezterm-nightly ``` ## MacPorts