Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ jobs:
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
run: |
test -n "$GOOGLE_CLIENT_ID" || { echo "Release builds require Google OAuth secrets"; exit 1; }
printf 'FREEMOUNT_GOOGLE_CLIENT_ID = %s\nFREEMOUNT_GOOGLE_CLIENT_SECRET = %s\nDEVELOPMENT_TEAM =\n' \
"$GOOGLE_CLIENT_ID" "$GOOGLE_CLIENT_SECRET" > Configs/Secrets.xcconfig
if [ -n "$GOOGLE_CLIENT_ID" ]; then
printf 'FREEMOUNT_GOOGLE_CLIENT_ID = %s\nFREEMOUNT_GOOGLE_CLIENT_SECRET = %s\nDEVELOPMENT_TEAM =\n' \
"$GOOGLE_CLIENT_ID" "$GOOGLE_CLIENT_SECRET" > Configs/Secrets.xcconfig
else
cp Configs/Secrets.xcconfig.example Configs/Secrets.xcconfig
fi

- name: Generate Xcode project
run: xcodegen generate
Expand Down
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ root/
### Security & Keychain
- Never write plaintext passwords, secret keys, or OAuth refresh tokens to plaintext config files.
- Store sensitive values in macOS Keychain (`Security.framework`).
- The Google OAuth desktop client committed in `Configs/Secrets.xcconfig.example`
is a shipped project default, public by design for installed apps — not a user
secret. User tokens and passwords remain Keychain-only.
- Obfuscate or stream config securely to `rclone` during mount creation.
- Check `.gitignore` to ensure credentials, `serviceAccountKey.json`, `*.pem`, `*.key`, and `rclone.conf` are strictly excluded.

Expand Down
26 changes: 18 additions & 8 deletions Configs/Secrets.xcconfig.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
// FreeMount Google OAuth Desktop Client Credentials
// FreeMount build defaults: project Google OAuth Desktop client + team.
//
// INSTRUCTIONS:
// 1. Copy this file to "Configs/Secrets.xcconfig"
// 2. Set your Apple Developer Team ID (https://developer.apple.com/account -> Membership)
// and your Google Cloud Console Desktop OAuth client credentials below.
// 3. Secrets.xcconfig is ignored by git and will never be committed.
// This ships a DEFAULT Google Desktop OAuth client on purpose. Desktop-app
// client credentials are public by design (they are embedded in every
// distributed desktop binary); they are NOT user secrets — user tokens and
// passwords live only in the macOS Keychain.
//
// Google may show an "unverified app" consent warning when signing in with
// Drive/GCS using this shared client, or you can create your own Desktop
// client in Google Cloud Console and replace the two values below.
// SFTP, WebDAV, SMB and FTP/FTPS need no OAuth client at all.
//
// Steps:
// 1. Copy this file to "Configs/Secrets.xcconfig" (or run
// scripts/install-from-source.sh, which does everything).
// 2. Set DEVELOPMENT_TEAM to your own Apple ID team (the installer can
// auto-detect it). Secrets.xcconfig stays git-ignored.

FREEMOUNT_GOOGLE_CLIENT_ID =
FREEMOUNT_GOOGLE_CLIENT_SECRET =
FREEMOUNT_GOOGLE_CLIENT_ID = 319728381325-v71u1mjithqc6ovqvbb4mnc0hhbf0r65.apps.googleusercontent.com
FREEMOUNT_GOOGLE_CLIENT_SECRET = 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

DEVELOPMENT_TEAM =
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,17 @@ The app starts an authenticated local `rclone rcd`, then registers File Provider

## Build

Requires macOS 14+, Xcode and XcodeGen. A free Apple ID is enough to build and run it locally.
Requires macOS 14+, Xcode and XcodeGen. A free Apple ID is enough to build and run it
locally. For a hands-off install use [`scripts/install-from-source.sh`](docs/install-from-source.md):

```bash
cp Configs/Secrets.xcconfig.example Configs/Secrets.xcconfig # add your Team ID and OAuth client
./scripts/install-from-source.sh
```

Manual path:

```bash
cp Configs/Secrets.xcconfig.example Configs/Secrets.xcconfig # set your Team ID (OAuth defaults are bundled)
xcodegen generate
xcodebuild -project FreeMount.xcodeproj -scheme FreeMount -configuration Debug -allowProvisioningUpdates build
swift test
Expand All @@ -59,7 +66,8 @@ signed with an Apple Developer ID and notarized. The app relies on App Groups,
shared Keychain access groups and a sandboxed File Provider extension —
entitlements that require a signing identity, so ad-hoc or unsigned builds do
not launch on other Macs. Building from source with your own free Apple ID is
the supported way to run it today.
the supported way to run it today — see
[docs/install-from-source.md](docs/install-from-source.md).

## Documentation

Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Documentation

- [building.md](building.md): requirements, signing, OAuth keys, build and test
- [install-from-source.md](install-from-source.md): end-user build-and-install path
- [architecture.md](architecture.md): components, ownership, state, reliability
- [security.md](security.md): Keychain, local daemon authentication
- [adding-a-provider.md](adding-a-provider.md): contributor guide for new providers
Expand Down
7 changes: 5 additions & 2 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ Edit `Configs/Secrets.xcconfig` (git-ignored):
| Key | Where to get it |
|---|---|
| `DEVELOPMENT_TEAM` | Your Team ID: Xcode → Settings → Accounts → select your team |
| `FREEMOUNT_GOOGLE_CLIENT_ID` / `FREEMOUNT_GOOGLE_CLIENT_SECRET` | Google Cloud Console → APIs & Services → Credentials → OAuth client of type **Desktop app** |
| `FREEMOUNT_GOOGLE_CLIENT_ID` / `FREEMOUNT_GOOGLE_CLIENT_SECRET` | Defaults are bundled; optionally your own Google Cloud Console **Desktop app** OAuth client |

Google Drive and GCS (Google Account sign-in) need your own OAuth client. SFTP,
The repository bundles a default Google Desktop OAuth client (public by
design for installed apps; replace it in your local copy if you want your own
quota or a verified consent screen). Google Drive and GCS sign-in work out of
the box with the bundled values. SFTP,
WebDAV, SMB, FTP and GCS service-account connections do not.

## Build and test
Expand Down
68 changes: 68 additions & 0 deletions docs/install-from-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Install FreeMount from source

FreeMount is free and MIT licensed, but there is no public download: Apple
only allows apps with App Groups, shared Keychain groups and a File Provider
extension to run when they are signed with a developer identity, and the
project has no paid Apple Developer account. You provide that identity
yourself with a **free Apple ID** in Xcode.

## One command

Install [Xcode](https://apps.apple.com/app/xcode/id497799835) (full app, not
just Command Line Tools), open it once and sign in with your Apple ID
(Xcode → Settings → Accounts), then:

```bash
git clone https://github.com/ChornyiDev/FreeMount.git
cd FreeMount
./scripts/install-from-source.sh
```

The installer detects your personal Team ID, configures the project, builds a
Release, signs it with your own Apple Development identity and installs
`/Applications/FreeMount.app`. Re-run the same command after `git pull` to
update.

## What the installer does manually

If you prefer to control each step:

```bash
cp Configs/Secrets.xcconfig.example Configs/Secrets.xcconfig
# put your Team ID into DEVELOPMENT_TEAM (Xcode → Settings → Accounts shows it)
brew install xcodegen
xcodegen generate
xcodebuild -project FreeMount.xcodeproj -scheme FreeMount \
-configuration Release -destination 'platform=macOS' \
-allowProvisioningUpdates build
# drag the built FM.app from DerivedData's Release folder to /Applications
```

## Google Drive / Google Cloud Storage sign-in

The repository ships default Google OAuth *desktop client* credentials.
Desktop client credentials are public by design; your tokens still go only to
your Keychain. Because the shared client is not verified by Google, the
consent screen may show an "unverified app" warning — it is expected and you
can proceed. To skip the warning (or for your own quota), create a free
"Desktop app" OAuth client in Google Cloud Console and replace the values in
`Configs/Secrets.xcconfig`. SFTP, WebDAV, SMB and FTP/FTPS need no OAuth at
all.

## Does a source build keep working?

Yes. Unlike iPhone development profiles, macOS does not re-check the weekly
provisioning window at launch: apps signed with your own Apple Development
identity run on your Mac for months (confirmed by the project author).
If a future macOS ever refuses to launch the app, re-running the installer
re-signs everything in one step.

## Limitations of this distribution track

- You are the builder: no notarized downloads, no auto-updates; updating is
`git pull` + re-run the script.
- Each user needs their own Apple ID with Xcode; work Macs with locked-down
Xcode policies may not allow personal team signing.
- The real product decision to change this is a paid Apple Developer ID plus
notarization; the release pipeline for that already exists in
`.github/workflows/release.yml`.
3 changes: 3 additions & 0 deletions scripts/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ official v1.75.1 darwin arm64/amd64 archives and caches extracted binaries.
`package-rclone-runtime.sh` embeds both binaries and the upstream MIT notice, then
signs helpers with the Xcode identity. `install-rclone-runtime.sh` atomically
installs the host architecture binary with ad-hoc development signing.
`install-from-source.sh` builds the full app with the user's personal team and
installs /Applications/FreeMount.app (the supported distribution path; see
docs/install-from-source.md).

## Current State
Version v1.75.1; no custom patches, source compilation or Go bootstrap.
Expand Down
74 changes: 74 additions & 0 deletions scripts/install-from-source.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/zsh
# Build FreeMount from source with your own free Apple ID and install it into
# /Applications. No paid developer account required.
#
# ./scripts/install-from-source.sh [--team <DEVELOPMENT_TEAM>]
#
# What it does: checks prerequisites, prepares Configs/Secrets.xcconfig
# (Google OAuth client defaults ship in the repo), detects or takes your
# personal team ID, builds Release, signs with your Apple Development
# identity and installs. Re-run the same command to update after `git pull`.

set -euo pipefail
cd "${0:A:h:h}"

team_override=""
while [[ $# -gt 0 ]]; do
case "$1" in
--team) team_override="$2"; shift 2 ;;
*) print -u2 "Unknown option: $1"; exit 2 ;;
esac
done

xcode-select -p >/dev/null || { print -u2 "Xcode is required (xcode-select --install or install Xcode)."; exit 1; }
command -v xcodegen >/dev/null || {
command -v brew >/dev/null || { print -u2 "XcodeGen missing and Homebrew not found. Install one: brew install xcodegen"; exit 1; }
print "Installing XcodeGen…"
brew install xcodegen
}

if [[ ! -f Configs/Secrets.xcconfig ]]; then
cp Configs/Secrets.xcconfig.example Configs/Secrets.xcconfig
print "Created Configs/Secrets.xcconfig from bundled defaults."
fi

# Resolve personal/team identifier: explicit flag, then config file, then Keychain.
team="$team_override"
[[ -z "$team" ]] && team="$(awk -F'=' '/^DEVELOPMENT_TEAM/ {gsub(/[ \t]/,"",$2); print $2}' Configs/Secrets.xcconfig)"
if [[ -z "$team" ]]; then
teams=($(security find-identity -p codesigning -v \
| sed -nE 's/.*"Apple Development: .*\(([A-Z0-9]{10})\)".*/\1/p' | sort -u))
if (( ${#teams[@]} == 0 )); then
print -u2 "No 'Apple Development' certificate found. Open Xcode → Settings → Accounts and sign in with your Apple ID once, then re-run."
exit 1
fi
(( ${#teams[@]} > 1 )) && print "Multiple development teams found; using ${teams[1]}. Pass --team <ID> to choose another."
team="${teams[1]}"
sed -i '' "s/^DEVELOPMENT_TEAM = .*/DEVELOPMENT_TEAM = $team/" Configs/Secrets.xcconfig
print "Auto-detected team $team and saved it to Configs/Secrets.xcconfig."
fi

print "Generating Xcode project…"
xcodegen generate

print "Building Release (first run may take a few minutes; Xcode provisions your personal team automatically)…"
xcodebuild -project FreeMount.xcodeproj -scheme FreeMount \
-configuration Release -destination 'platform=macOS' \
-derivedDataPath build/install-dd \
DEVELOPMENT_TEAM="$team" \
-allowProvisioningUpdates \
build >/tmp/freemount-install-build.log 2>&1 || {
tail -20 /tmp/freemount-install-build.log
print -u2 "Build failed; full log: /tmp/freemount-install-build.log"
exit 1
}

APP="build/install-dd/Build/Products/Release/FM.app"
codesign --verify --deep --strict "$APP" || { print -u2 "Built bundle failed signature verification."; exit 1; }

pkill -x FM 2>/dev/null || true
if [[ -d /Applications/FreeMount.app ]]; then rm -rf /Applications/FreeMount.app; fi
cp -R "$APP" /Applications/FreeMount.app

print "Installed /Applications/FreeMount.app — launching."
open /Applications/FreeMount.app
Loading