Installing Gryphon
Welcome! Here’s everything you’ll need to install Gryphon and follow the tutorials on this website.
- Option 1: Using Gryphon on macOS or Linux
- Option 2: Using Gryphon on Docker
- Option 3: Using Gryphon on GitPod
- Using different Swift versions
Option 1: Using Gryphon on macOS or Linux
Homebrew
The easiest way to install Gryphon is with Homebrew, which also installs all dependencies.
$ brew install vinivendra/gryphon/gryphon
Manually
You can also skip homebrew and install Gryphon manually. You can do it using the Swift Package Manager via Mint:
$ mint install vinivendra/Gryphon
Or building from the source:
$ git clone https://github.com/vinivendra/Gryphon.git
$ cd Gryphon
$ ./Scripts/install.sh
Make sure you also download any dependencies you need. Gryphon uses Ruby and the Xcodeproj tool for Xcode integration. You might also want to get Kotlin, Java, and Android Studio to follow some of the tutorials.
Option 2: Using Gryphon on Docker
Docker containers are guaranteed to work the same in all compatible systems, so they can be useful if you have problems with the installation or the dependencies. The Gryphon repository includes a Dockerfile that builds a Docker container already loaded with Swift, Kotlin and Java. You can build the container with
$ git clone https://github.com/vinivendra/Gryphon.git
$ cd Gryphon
$ docker build -t gryphon .
Then, whenever you want to run the container:
$ docker run -it --rm --privileged -v /path/to/Gryphon/:/app/Gryphon gryphon
where /path/to/Gryphon/
should be an absolute path to the current folder (i.e. the cloned Gryphon repository).
Once the container is running you can build Gryphon, create a shortcut to the built binary, then run it:
$ swift build
$ ln -s .build/debug/gryphon gryphon
$ ./gryphon "Test files/test.swift"
Option 3: Using Gryphon on GitPod
The Docker container is also available as a GitPod workspace where you can use Gryphon online, without having to install it or download it. You can run Gryphon in the workspace directly with
$ ./gryphon "Test files/test.swift"
Using different Swift versions
Gryphon executables are linked with the Swift version used to build them. For example, if you install Gryphon using Swift 5.3, the resulting gryphon
executable will be linked to the Swift 5.3 parser, and will always parse Swift code following the Swift 5.3 rules:
$ swift --version
Apple Swift version 5.3
$ brew install vinivendra/gryphon/gryphon
$ gryphon --version
Gryphon version x.y.z, using the Swift 5.3 parser
If you ever need Gryphon to use a different Swift version, just install it again using the Swift version of your choice.
When using Docker, the Swift version is defined in the first line of the Dockerfile. You can change that line and call docker build
again to change the Swift version:
FROM swift:5.3
What’s next?
Now that the installation is ready, check out how to use Gryphon’s command line interface to translate a command line program in Swift, or go straight to iOS by translating a new iOS app to Android or by adding Gryphon to an existing app.