Skip to content

Commit 3d1ce3c

Browse files
committed
macos: codesign for new macos security limitation
Before this change: 1. CALM itself will be shown as a damaged application, the user has to de-quarantine it with command line: xattr -d com.apple.quarantine /Applications/Calm.app 2. CALM made applications, will also be shown as damaged, the user also has to de-quarantine them. After this change: 1. CALM itself still be shown as a damaged application. 2. CALM made applications, will shown as: "cannot be opened because the developer cannot be verified." which is better, since the user could open it with right click.
1 parent d7c5039 commit 3d1ce3c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

build/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ build_darwin () {
4545
echo "build launcher ..."
4646
brew install gcc
4747
gcc src/calm.c -o calm
48+
# codesign for macos-14 enhanced security
49+
codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime calm
4850

4951
echo "remove Windows fonts dir ..."
5052
sed '/<dir>C:\\Windows\\Fonts<\/dir>/d' s/usr/all/fonts.conf > tmp-fonts.conf

s/dev/darwin/config-lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ ls -lah .
6565
# copy all typelibs
6666
cp -L -R $(brew --prefix)/lib/girepository-1.0/*.typelib ./
6767

68-
# codesign for macos-14, since we changed those libs
68+
# codesign for macos-14 enhanced security
6969
ls *.dylib | xargs -I _ codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime _
70+
ls *.typelib | xargs -I _ sudo codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime _

s/usr/macos/bundle.lisp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
(dist-dir-abs (or (uiop:absolute-pathname-p dist-dir)
1414
(uiop:merge-pathnames* dist-dir *calm-env-app-dir*)))
1515
(app-icon-abs (or (uiop:absolute-pathname-p app-icon)
16-
(uiop:merge-pathnames* app-icon *calm-env-app-dir*))))
16+
(uiop:merge-pathnames* app-icon *calm-env-app-dir*)))
17+
(codesign-cmd "codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime "))
1718

1819
;; clean old bunlde
1920
(uiop:delete-directory-tree app-dir :validate t :if-does-not-exist :ignore)
@@ -38,7 +39,17 @@
3839
dist-dir-abs
3940
app-macos-dir)
4041
;; copy icon
41-
(u:copy-file app-icon-abs (merge-pathnames "icon.icns" app-resources-dir)))
42+
(u:copy-file app-icon-abs (merge-pathnames "icon.icns" app-resources-dir))
43+
44+
(u:calm-log "signing everything... (some files need sudo permission)")
45+
(u:exec (str:concat "find " app-name ".app/Contents/MacOS/ -type f | xargs -I _ sudo " codesign-cmd " _")
46+
:ignore-error-status t)
47+
(u:calm-log "signing calm launcher...")
48+
(u:exec (str:concat "sudo " codesign-cmd app-name ".app/Contents/MacOS/calm")
49+
:ignore-error-status t)
50+
(u:calm-log "signing the application bundle itself...")
51+
(u:exec (str:concat "sudo " codesign-cmd app-name ".app")
52+
:ignore-error-status t))
4253

4354
(u:calm-log-fancy "~%Application Bundle created: ~A.app~%" app-name))
4455

0 commit comments

Comments
 (0)