|
| 1 | +# Building, Certifying, Archiving, and Uploading LogGPT (Safari Extension) from the Command Line |
| 2 | + |
| 3 | +This guide explains how to build, archive, sign, notarize, and upload the LogGPT Safari Extension to the Mac App Store **outside of Xcode** using command-line tools. This is useful for automation, CI/CD, or advanced users who prefer not to use Xcode's GUI. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 1. Prerequisites |
| 8 | + |
| 9 | +- **Xcode** and Xcode command-line tools installed |
| 10 | +- **Apple Developer account** with valid certificates (Distribution, Developer ID, etc.) |
| 11 | +- **Provisioning profiles** downloaded and installed |
| 12 | +- **Transporter** app (for App Store upload) or access to `xcrun altool` |
| 13 | +- **Project Scheme:** `LogGPT` (or your custom scheme) |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## 2. Clean and Build the Project |
| 18 | + |
| 19 | +```bash |
| 20 | +cd /path/to/LogGPT |
| 21 | +xcodebuild -project LogGPT/LogGPT.xcodeproj -scheme LogGPT clean build | tee build.log |
| 22 | +``` |
| 23 | +- Output will be in `build.log`. Check for errors: |
| 24 | + ```bash |
| 25 | + grep -i error build.log |
| 26 | + ``` |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## 3. Archive the Project |
| 31 | + |
| 32 | +```bash |
| 33 | +xcodebuild -project LogGPT/LogGPT.xcodeproj -scheme LogGPT -configuration Release archive -archivePath ./build/LogGPT.xcarchive | tee archive.log |
| 34 | +``` |
| 35 | +- Check for errors: |
| 36 | + ```bash |
| 37 | + grep -i error archive.log |
| 38 | + ``` |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## 4. Export the Archive for Distribution |
| 43 | + |
| 44 | +Prepare an `ExportOptions.plist` (see Xcode docs for template; usually 'app-store' method for App Store): |
| 45 | +```xml |
| 46 | +<?xml version="1.0" encoding="UTF-8"?> |
| 47 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 48 | +<plist version="1.0"> |
| 49 | +<dict> |
| 50 | + <key>method</key> |
| 51 | + <string>app-store</string> |
| 52 | + <key>teamID</key> |
| 53 | + <string>YOUR_TEAM_ID</string> |
| 54 | +</dict> |
| 55 | +</plist> |
| 56 | +``` |
| 57 | + |
| 58 | +Export: |
| 59 | +```bash |
| 60 | +xcodebuild -exportArchive -archivePath ./build/LogGPT.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath ./build | tee export.log |
| 61 | +``` |
| 62 | +- Check for errors: |
| 63 | + ```bash |
| 64 | + grep -i error export.log |
| 65 | + ``` |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## 5. Notarize (for Mac apps, optional for Safari Extensions) |
| 70 | + |
| 71 | +If required, notarize the exported .app or .pkg: |
| 72 | +```bash |
| 73 | +xcrun notarytool submit ./build/LogGPT.pkg --apple-id "YOUR_APPLE_ID" --team-id "YOUR_TEAM_ID" --password "APP_SPECIFIC_PASSWORD" --wait |
| 74 | +``` |
| 75 | +- Check the notarization status as instructed by the tool. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## 6. Upload to App Store Connect |
| 80 | + |
| 81 | +Using Transporter app (GUI) or command line: |
| 82 | + |
| 83 | +**With Transporter GUI:** |
| 84 | +- Open Transporter, sign in, drag the exported `.ipa` or `.pkg` file and upload. |
| 85 | + |
| 86 | +**With altool (deprecated, but still available):** |
| 87 | +```bash |
| 88 | +xcrun altool --upload-app -f ./build/LogGPT.pkg -t osx -u "YOUR_APPLE_ID" -p "APP_SPECIFIC_PASSWORD" |
| 89 | +``` |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## 7. Troubleshooting & Checking for Errors |
| 94 | + |
| 95 | +- Always check your build, archive, and export logs for the word `error`. |
| 96 | +- If you see code signing or provisioning errors, verify your certificates and provisioning profiles. |
| 97 | +- For detailed build issues, search for `error:` or `failed` in the logs. |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## 8. Additional Notes |
| 102 | + |
| 103 | +- Some steps (like provisioning, entitlements, or fixing signing issues) may still require Xcode for initial setup. |
| 104 | +- For Safari Extensions, Xcode manages entitlements and packaging best. Use the command line for automation, but validate in Xcode if you encounter issues. |
| 105 | +- Always test your extension in Safari before submitting to the App Store. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## References |
| 110 | +- [Apple: Distributing Apps Using Command Line Tools](https://developer.apple.com/documentation/xcode/distributing-your-app-for-testing-and-release) |
| 111 | +- [xcodebuild Man Page](https://ss64.com/osx/xcodebuild.html) |
| 112 | +- [Transporter App](https://apps.apple.com/us/app/transporter/id1450874784) |
| 113 | +- [Notarizing macOS Software](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) |
0 commit comments