Skip to content

Instantly share code, notes, and snippets.

@cmho
Created January 1, 2019 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmho/00cadbce6b91de168abd8242fbfe2735 to your computer and use it in GitHub Desktop.
Save cmho/00cadbce6b91de168abd8242fbfe2735 to your computer and use it in GitHub Desktop.

The easiest way to run Pixelfed for development on Mac is using Laravel's Valet. Valet contains a number of tools to run the application locally with minimal fuss.

You'll need to install Homebrew, a Mac package manager, to start off. Once you've installed Homebrew, if you haven't already installed PHP 7.3, install it with brew install php.

After installing PHP, you'll want to install Composer, which is a PHP dependency manager that can also install Valet for you. Then run composer global require laravel/valet, which will install Valet as a globally-available program. To access it, be sure to add ~/.composer/vendor/bin to your shell's PATH variable. Then run valet install to finish installing Valet's dependencies.

Running the valet park command inside a folder will allow you to access [subfolder].test as a local domain. You can set this up however you wish, though an easy way is to create a ~/Sites folder and create a symlink to the Pixelfed application's public folder called pixelfed. Then, you should be able to visit pixelfed.test and see the application.

You will also need to use SSL for Pixelfed, so in your parked folder, run valet secure pixelfed to create a faux-SSL cert for the application on your machine. Note that some browsers still will not recognize it, and you'll have to override the security warnings.

NOTE: by default, Valet serves applications on *.test domains. Google Chrome will sometimes decide not to support a non-standard domain suffix, which will lead to mysterious errors. If you encounter an error connecting to your local site once it's running, try checking it in Safari, which is most lenient. You can switch to another TLD with valet domain tld-name.

If you haven't already set up the .env file or run the basic install tasks for your application, you can do that now by going to your application's top-level folder.

Log into MySQL to set up the database. If you don't want to use the command line, you can use an application like Sequel Pro. If you're on the command line, you should be able to just log in with mysql; from Sequel Pro set the domain to 127.0.0.1 and the username to root. From there, create a database of whatever name you like and remember it.

You'll want to copy the .env.example file to a file called .env update the following settings in the new file:

  • APP_URL=https://pixelfed.test (or whatever domain you ended up using)
  • ADMIN_DOMAIN=pixelfed.test
  • APP_DOMAIN=pixelfed.test
  • DB_DATABASE=[the name you set earlier]
  • DB_USERNAME=root

Then we can finish the setup tasks for the Pixelfed application:

composer install // downloads and installs the dependencies
php artisan key:generate // generates an application key and puts it in .env
php artisan storage:link // generates some symlinks between parts of the application storage
php artisan migrate // populates the database with the necessary table structure

You'll also want to brew install redis and then run redis-server to start Redis, which powers some of the backend services like sessions, the queue, and the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment