Skip to content

Commit e21f686

Browse files
committed
fix: Remove legacy code for checking macime executable path (macimed works without macime from v4.x)
1 parent 883cb31 commit e21f686

6 files changed

Lines changed: 29 additions & 60 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## [4.4.2](https://github.com/riodelphino/macime/compare/v4.4.1...v4.4.2) (2026-04-17)
4+
5+
* **fix:** Remove legacy code for checking `macime` executable path (`macimed` works without `macime` from v4.x)
6+
37
## [4.4.1](https://github.com/riodelphino/macime/compare/v4.4.0...v4.4.1) (2026-04-17)
48

59
* **docs:** Add how to get `log-path` with `brew services`

README.md

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ delivering near-native IME switching speed.
1111
</p>
1212

1313
<p align="center">
14-
<img src="https://img.shields.io/github/v/tag/riodelphino/macime?tag=v4.4.1&style=for-the-badge&cacheSeconds=60" />
14+
<img src="https://img.shields.io/github/v/tag/riodelphino/macime?tag=v4.4.2&style=for-the-badge&cacheSeconds=60" />
1515
<img src="https://img.shields.io/badge/License-MIT-%232196F3.svg?style=for-the-badge" />
1616
<img src="https://img.shields.io/badge/Swift-5.x-orange.svg?style=for-the-badge&logo=swift&logoColor=white" />
1717
<img src="https://img.shields.io/badge/Easy%20Install-Homebrew-%23FBB040?style=for-the-badge" />
@@ -56,6 +56,8 @@ If you’re a Mac user frustrated by slow IME switching, give it a try.
5656

5757
## ⚠️ Breaking Changes
5858

59+
* [v4.4.2](https://github.com/riodelphino/macime/releases/tag/v4.4.2):
60+
* Remove legacy code for checking `macime` executable path. (`macimed` works without `macime` from `v4.x`.)
5961
* [v4.4.0](https://github.com/riodelphino/macime/releases/tag/v4.4.0):
6062
* Add pre-compiled binaries (`macime`, `macimed`) - no `xcode` or build required.
6163
* [v4.0.0](https://github.com/riodelphino/macime/releases/tag/v4.0.0):
@@ -92,23 +94,25 @@ Select specific version and CPU architecture from:
9294

9395
for Intel Mac:
9496
```bash
95-
curl -L -O https://github.com/riodelphino/macime/releases/download/v4.4.0/macime-v4.4.0-x86_64.tar.gz
96-
tar -zxvf macime-v4.4.0-x86_64.tar.gz
97+
curl -L -O https://github.com/riodelphino/macime/releases/download/v4.4.2/macime-v4.4.2-x86_64.tar.gz
98+
tar -zxvf macime-v4.4.2-x86_64.tar.gz
9799
mv macime macimed ~/bin
98100
```
99101
for Apple Silicon:
100102
```bash
101-
curl -L -O https://github.com/riodelphino/macime/releases/download/v4.4.0/macime-v4.4.0-arm64.tar.gz
102-
tar -zxvf macime-v4.4.0-arm64.tar.gz
103+
curl -L -O https://github.com/riodelphino/macime/releases/download/v4.4.2/macime-v4.4.2-arm64.tar.gz
104+
tar -zxvf macime-v4.4.2-arm64.tar.gz
103105
mv macime macimed ~/bin
104106
```
105-
Then add environmental variable to your `~/.zshrc` or `~/.bashrc` or `~/.profile`:
107+
To change default sock-path and temp-dir, set environmental variable to your `~/.zshrc` or `~/.bashrc` or `~/.profile`:
106108
```bash
107-
export MACIME_PATH="$HOME/bin/macime"
109+
export MACIME_SOCK_PATH="/tmp/riodelphino.macimed.sock"
110+
export MACIME_TEMP_DIR="/tmp/riodelphino.macime"
108111
```
109112

110-
* Replace `v4.4.0` to your desired version tag.
111-
* Replace `~/bin` and `$HOME/bin/macime` to your desired directory.
113+
* Replace `v4.4.2` to your desired version tag.
114+
* Replace `~/bin` and `/tmp/riodelphino.macime` to your desired directory.
115+
* Relpace `/tmp/riodelphino.macimed.sock` to your desired path.
112116
* Execute permission has already been granted.
113117

114118

@@ -124,7 +128,7 @@ brew untap riodelphino/tap
124128
### ⚙️ Manual
125129

126130
- Remove installed binaries.
127-
- Remove the `MACIME_PATH` environmental variable.
131+
- Remove the environmental variables.
128132

129133

130134
## ⬆️ Upgrade
@@ -392,22 +396,13 @@ require("macime").send("daemon get sock-path", function(ok, data) if ok then pri
392396
require("macime").send("daemon set log-level debug", function(ok, data) if ok then print(data) end end)
393397
```
394398
395-
#### 📍 macime Executable Path
396-
397-
`macimed` requires the full-path of `macime`.
398-
399-
It is determined from one of the following paths:
400-
- `MACIME_PATH` (Environment variable)
401-
- `/usr/local/bin/macime` (Homebrew on Intel Mac)
402-
- `/opt/homebrew/bin/macime` (Homebrew on Apple Silicon)
403-
404399
#### 🔌 Sock path
405400
406401
`macimed` listen to the `socket` for receiving/sending daemon commands.
407402
408403
The sock path is determined from one of the following paths:
409404
- `MACIME_SOCK_PATH` (Environment variable)
410-
- `/tmp/riodelphino.macimed.sock`
405+
- `/tmp/riodelphino.macimed.sock/`
411406
412407
#### 📁 Temp dir
413408
@@ -424,6 +419,14 @@ The previous IDs are stored in following files:
424419
425420
These files are deleted automatically when you shutdown macOS.
426421
422+
#### ⚠️ macime path
423+
424+
These legacy code have been deprecated in `v4.4.2`:
425+
- `MACIME_PATH` environmental variable
426+
- Checking `macime` executable
427+
428+
Since `macimed` does not require `macime` executable outside anymore in `v4.x`. They are sharing IME switching class/functions internally.
429+
427430
428431
### ▶️ Run daemon
429432
@@ -479,18 +482,6 @@ To check the log path:
479482
- Run `cat ~/Library/LaunchAgents/homebrew.mxcl.macime.plist`, find `StandardErrorPath` item.
480483
- or Run `:checkhealth macime` in neovim. (Requires [macime.nvim](https://github.com/riodelphino/macime.nvim))
481484
482-
#### 📍 MACIME_PATH Enviroment Variable
483-
484-
The `MACIME_PATH` is set at `brew install` time via `riodelphino/homebrew-tap/Fomula/macime.rb`:
485-
```ruby
486-
service do
487-
...
488-
environment_variables(
489-
MACIME_PATH: opt_bin/"macime"
490-
)
491-
...
492-
end
493-
```
494485
495486
## 🔗 Integration
496487
@@ -546,12 +537,6 @@ swift build
546537
swift build -c release
547538
```
548539
549-
For debugging, temporary run the built `macimed` with the locally built `macime`:
550-
```bash
551-
# In the macime repository root:
552-
MACIME_PATH=.build/release/macime .build/release/macimed
553-
```
554-
555540
## 🙏 Thanks To
556541
557542
- The IME switching concept is inspired by [im-select](https://github.com/daipeihust/im-select) and [macism](https://github.com/laishulu/macism)

Sources/MacIMEKit/Args.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ public enum IMEDArgs {
201201
}
202202
i += 1
203203
}
204-
guard FS.pathExists(state.macimePath ?? "") else {
205-
throw AppError.imed(.macimeNotFound(state.macimePath ?? ""))
206-
}
207204

208205
return state
209206
}

Sources/MacIMEKit/Errors.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public enum UtilError: Error {
9292

9393
public enum IMEDError: Error {
9494
case dataNotRecieved
95-
case macimeNotFound(String)
9695
case sockPathNotFound(String)
9796
case macimeReturnsError(String)
9897
case invalidDaemonMethod(String)
@@ -108,8 +107,6 @@ public enum IMEDError: Error {
108107
switch self {
109108
case .dataNotRecieved:
110109
return "Data not recieved."
111-
case let .macimeNotFound(path):
112-
return "macime executable not found: \(path)"
113110
case let .sockPathNotFound(path):
114111
return "sock-path not found: \(path)"
115112
case let .macimeReturnsError(err):

Sources/MacIMEKit/IMED.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public enum IMED {
7373

7474
switch subcmd {
7575
case .info:
76-
let json: [String: Any] = ["status": state.status ?? "", "sock-path": state.sockPath ?? "", "macime-path": state.macimePath ?? ""]
76+
let json: [String: Any] = ["status": state.status ?? "", "sock-path": state.sockPath ?? ""]
7777
stdout = try Util.jsonToString(json, options: [.withoutEscapingSlashes])
7878
case .get:
7979
guard args.count > 0 else {
@@ -83,8 +83,6 @@ public enum IMED {
8383
switch target {
8484
case "sock-path":
8585
stdout = state.sockPath ?? ""
86-
case "macime-path":
87-
stdout = state.macimePath ?? ""
8886
default:
8987
throw AppError.imed(.invalidGetTarget(target))
9088
}

Sources/MacIMEKit/Types.swift

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@ import Foundation
22

33
/// [Common] Default values
44
public enum Defaults {
5-
public static let version: String = "4.4.1"
6-
7-
public static func macimePath() throws -> String {
8-
let env = ProcessInfo.processInfo.environment
9-
let checkPaths = [env["MACIME_PATH"], "/usr/local/bin/macime", "/opt/homebrew/bin/macime"]
10-
let path = Util.fallbackPaths(checkPathExists: true, paths: checkPaths)
11-
guard let path else {
12-
throw AppError.config(.invalidMacimePath)
13-
}
14-
return path
15-
}
5+
public static let version: String = "4.4.2"
166

177
public static func sockPath() throws -> String {
188
let env = ProcessInfo.processInfo.environment
@@ -174,14 +164,12 @@ public enum IMEFieldList {
174164

175165
/// [IMED] State
176166
public struct IMEDState {
177-
public var macimePath: String?
178167
public var sockPath: String?
179168
public var status: String?
180169
public var logPath: String?
181170
public var errPath: String?
182171
public var debug: Bool = false
183172
public init() throws {
184-
macimePath = try Defaults.macimePath()
185173
sockPath = try Defaults.sockPath()
186174
status = try IMED.isMacimedRunning(sockPath: Defaults.sockPath()) ? "running" : "stopped"
187175
}

0 commit comments

Comments
 (0)