Is there a way I can programmatically download the latest version of Craft?

31

10

If you have a base install script that you use to quickly turn out a new base install for Craft, it would be very useful for that script to be able to download the latest version of Craft when doing it’s new site setup logic.

What’s the best way to do that?

Brad Bell

Posted 2014-06-15T21:44:51.613

Reputation: 53 205

2

Note: If said base install script were made publicly available (e.g. https://github.com/mattstauffer/makeItCraft/ ), be sure to prompt the user for license acceptance so that it doesn't become a method of someone theoretically bypassing accepting the user agreement.

– Matt Stauffer – 2014-06-16T13:39:23.200

Answers

36

In Craft 2:

You can always get the latest version and build of Craft in either zip or tar.gz format by going to:

http://craftcms.com/latest.zip?accept_license=yes

You can change the extension to tar.gz if you prefer that format.

http://craftcms.com/latest.tar.gz?accept_license=yes

Note that the accept_license=yes parameter, which indicates that you accept Craft’s license agreement, must be in the URL for this to work.

If you're doing this from the command line using curl, for example, use the -L flag so it will follow redirects:

curl -O -L http://craftcms.com/latest.zip?accept_license=yes

In Craft 3:

You can cURL and download the archive from the Craft Github repo release page. Or since Craft 3 is Composer based, you can modify your composer.json's craftcms/cms line to install the specific version you're looking for.

Brad Bell

Posted 2014-06-15T21:44:51.613

Reputation: 53 205

1cool! didn't know that flag was there, thought you wanted to block commandline downloads when you added that js tickbox! thanks! – Luke Holder – 2014-06-16T06:59:01.633