SilverSmith CLI: The Alpha Release Cometh
4 Apr
The first official release of SilverSmith is here, in the form of a command-line interface (CLI) toolset. Watch the video and learn how to:
- Install SilverSmith CLI (it’s painless)
- Initialize a SilverSmith project
- Build gobs of beautiful code with one command
- Create pre-populated templates instantly
- Build your site architecture, and seed it with placeholder content
CLI? What Happened?
A few months ago, the SilverSmith project hit a wall. I realized that I was trying to cram a system application into a web application, and paying dearly for it. There was too much overhead and I was creating complex web-based solutions for problems that the desktop handles elegantly and easily. I didn’t want to put the energy into a test release if the product itself was fundamentally flawed. It made much more sense to initially release SilverSmith as a command-line toolset in order to best showcase its utility without the trappings of graphical user interface getting in the way.
Best of all, SilverSmith is no longer a SilverStripe module, so it is available for all of your projects with no redundancy, and it upgrades itself.
Will there still be a GUI application?
Absolutely. An OSX desktop application is in the works. This application will serve as a code editor tailored for SilverStripe development. It will be able to run the SilverSmith CLI tools from within the interface, allowing you to take full advantage of SilverSmith without ever opening the Terminal.
A segmented release like this will allow us to have distinct bodies of testing for both the toolset itself and the user interface. Releasing the CLI tools first will ensure that when the GUI is ready, it will be working with a stable base of tools.
You seem to have neglected Windows.
For the time being, yes, but most of that is owed to my lack of a testing environment for Windows, and I just don’t know enough about how command-line PHP works in a Windows system. Any Windows fanatics who want to share their knowledge are welcome to write to Uncle Cheese about assisting in the development of Windows compatibility.
How do I install SilverSmith CLI?
Just run the following command at the terminal:
curl http://www.silversmithproject.com/install | sh
… and how do I use it?
True documentation and more detailed tutorials are on the way, but for now, everything you need is in the video.
Help! I found a bug! I thought you said this thing was alpha?
Bugs will be plentiful and persistent. Please visit the following address to post bug reports:
http://www.silversmithproject.com/bugs
Are all of your blogs going to engage an annoying fake dialog with the reader?
Just trying something new.




First of all, wow. Uncle Cheese, your work never ceases to amaze me. From tutorials to modules and SS extras I can’t begin to say how much I have learned.
I’ve been waiting to get my hands on SilverSmith for quite some time and I’m quite excited to have the chance. Thank you.
Maybe I missed something a while back, but I thought that SilverSmith was going to be a SS3 tool. In the screencast it looks like you’re using SS2. When I tried to init on a SS3 beta install it didn’t seem to work. I’m not complaining, but just wondering what the requirements and support are at this point and what you’re planning on doing with it.
Again, thanks for all of the hard work and dedication to helping fake developers like myself turn into real developers.
Hi, Patrick,
Thanks for your interest. SilverSmith is and has always been a 2.x tool. A 3.0 version will be available once we reach beta. But for now, do your testing in a 2.x environment.
Got it. Thanks.
Well, thanks for the amazing work.
I just wanted to give you a quick feedback from an ubuntu user, everything works very painlessly
So I’d suggest every windows user to upgrade their system to a beautiful, open source ubuntu (LTS 12.04 is coming)
It works on Linux?! SCORE!!!
It even get’s the colors in Terminal right
Ok for all the other idiots and masochists out there I actually got this running on Windows. Not something I really recommend but it’s doable, at least if you have the GIT command prompt installed.
What you have to do is download the silversmith.tar.gz manually, put it in a folder somewhere, update the Windows path variable so you can run the command wherever you want and then update the first line of the silversmith file. The first line looks like this: #!/usr/bin/php and you need to update that so that it points to your php installation.
Excellent work as always Cheese!
Thanks, Marcus. I’ve updated the executable “silversmith” to work as a bash script and find the path to the PHP executable, and then run $php /usr/local/lib/silversmith/bin/silversmith.php {*}
Some users were saying that #!/usr/bin/php was a bad interpreter. Can’t imagine why. Maybe a brew installation, or something?
Either way, probably makes sense not to hard code the interpreter.
hi unclecheese
maybe you better replace
“$php /usr/local/lib/silversmith/bin/silversmith.php”
to something like this:
dir = `dirname $0`
$php $dir/silversmith.php
because on a windows machine your path would be wrong, as the file can be anywhere. If you get the path with dirname you will allways have the right directory, even your silversmith folder is somwhere else.
I haven’t tried this only with Windows and MinGW32, not on a Unix machine. But this should also work on a Unix/Apple machine.
I love this idea! I didn’t know how to get the current directory. `dirname $0` is apparently what I was looking for. Hopefully with testers like you, we’ll be able to iron out the idiosyncrasies of running CLI in Windows.
That update has been pushed into the latest version. Just type “silversmith upgrade” and you’re good to go.
Coming as an OSX desktop application, fantastic! This is a much better solution than a module. You’re right, the builder doesn’t need to/shouldn’t be part of the hosted site files and a desktop application is perfect for this.
When it’s ready you should put it in the Mac App store for a small fee and actually make some money out of it (you deserve it). I’m sure anyone who needs it would be happy to pay. Plus that way you can deliver auto-updates to the app easily.
Thanks, Neil. I’m not sure the App Store would accept it since it’s such a niche market, but it will definitely be a licensed product once it’s out of beta.
Hi – almost certainly my fault, but I can’t get this to work on my macbook pro running Mac OS X Lion. The install says it was a success but if I type silversmith help I get told “command not found”. Any ideas?
I just want to congratulate UC for a job well done. I have been reading most of your articles and it helped me a lot.
Keep up the good work.
awesome build toolset. just make develoeprs’ life easier. for most handons developers, terminal operation would be the fastest and most efficient way for setting up a ss site.
Hy dude. I would like to know, when a version vor silverstripe 3 is released or the mac gui. I think it will push steps through dev straigth forward.
Greetings
SilverSmith has been SS3 compatible for a few months now!
I have installed SS3 on local MAMP, but I get a MySQL error in terminal after “silversmith init” command:
md-mac:WinoPress mac$ silversmith init
Running in SilverStripe 3 mode
ERROR [User Error]: Couldn’t connect to MySQL database | No such file or directory
IN
Line 564 in /Users/mac/Sites/winopress/framework/model/MySQLDatabase.php
Source
======
555: }
556:
557: function databaseError($msg, $errorLevel = E_USER_ERROR) {
558: // try to extract and format query
559: if(preg_match(‘/Couldn\’t run query: ([^\|]*)\|\s*(.*)/’, $msg, $matches)) {
560: $formatter = new SQLFormatter();
561: $msg = “Couldn’t run query: \n” . $formatter->formatPlain($matches[1]) . “\n\n” . $matches[2];
562: }
563:
* 564: user_error($msg, $errorLevel);
565: }
566:
567: /**
568: * Return a boolean type-formatted string
569: *
570: * @param array $values Contains a tokenised list of info about this data type
Trace
=====
user_error(Couldn’t connect to MySQL database | No such file or directory,256)
MySQLDatabase.php:564
MySQLDatabase->databaseError(Couldn’t connect to MySQL database | No such file or directory)
MySQLDatabase.php:60
MySQLDatabase->__construct(Array)
DB.php:97
DB::connect()
silversmith.php:3834
I have the site running well on my local server under: localhost:8888/mysite
any idea what causes the error, thanks
It’s an issue with MAMP that causes it to conflict with other installations of MySQL. Try: http://boriskuzmanovic.wordpress.com/2008/11/26/mamp-error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock-2/
Hi there,
UC great job man, u done very good job thanks you so much.
I have problem whit installation on linux Ubuntu 12.4.
I think that is problem in path file, because , when install silversmith i don’t have silversmith directory in “/var/www/”
Any ideas how to fix this problem?
Well, nothing should be in /var/www, because it’s a CLI tool, so HTTP is not in play. The problem with MySQL is almost always related to having to versions of MySQL running concurrently. The same error pops up in Symfony when you try to run its CLI database tools. You need to symlink your /var/mysql/mysql.sock to your MAMP/mysql.sock.
@kumosal
Had you fixed it done ? I got an error like it.
@All
Any ideas how to fix this problem?
Thanks