 					grunt.log.write "OK."
 				callback()
 
-
+		checkMake: (callback = (error) ->) ->
+			grunt.log.write "Checking make is installed... "
+			exec "make --version", (error, stdout, stderr) ->
+				if error? and error.message.match("command not found")
+					grunt.log.error "FAIL."
+					grunt.log.errorlns """
+					Either make is not installed or is not in your path.
+
+					On Ubuntu you can install make with:
+
+					    sudo apt-get install build-essential
+
+					"""
+					return callback(error)
+				else if error?
+					return callback(error)
+				else
+					grunt.log.write "OK."
+					return callback()
+
+
+
+

		Helpers.checkLatexmk @async()
	grunt.registerTask "check:s3", "Check that Amazon S3 credentials are configured", () ->
		Helpers.checkS3 @async()
	grunt.registerTask "check", "Check that you have the required dependencies installed", ["check:redis", "check:latexmk", "check:s3"]

	Helpers =

	grunt.registerTask 'install:config', "Copy the example config into the real config", () ->
		Helpers.installConfig @async()
	grunt.registerTask 'install:all', "Download and set up all ShareLaTeX services",
		["check:make"].concat(
			("install:#{service.name}" for service in SERVICES)
		).concat(["install:config"])
	grunt.registerTask 'install', 'install:all'
	grunt.registerTask 'update:all', "Checkout and update all ShareLaTeX services",
		["check:make"].concat(
			("update:#{service.name}" for service in SERVICES)
		)
	grunt.registerTask 'update', 'update:all'
	grunt.registerTask 'run', "Run all of the sharelatex processes", ['concurrent:all']
	grunt.registerTask 'run:all', 'run'
