#Installation Guide for Sourcegraph on macOS
Sourcegraph is a code search and navigation tool that is designed to help developers to find and understand the code easily. The following tutorial provides a step-by-step guide to install Sourcegraph on macOS.
##Prerequisites
- A working macOS machine with an internet connection.
- A terminal app.
##Steps
Open the terminal app on your macOS machine.
Install Docker on the system. Execute the following command in the terminal:
brew cask install docker
After installation, launch Docker by typing 'Docker' in Spotlight or Applications.
Clone the Sourcegraph Docker configuration repository using the following command:
git clone https://github.com/sourcegraph/deploy-sourcegraph.git && cd deploy-sourcegraph
Create a personal access token on the Sourcegraph website by visiting
https://sourcegraph.com/user/settings/tokens. This token will be used to authenticate Sourcegraph to your code hosting provider. Save the token in a safe place, as you will not be able to retrieve it once this page is closed.Open the
.envfile in thedeploy-sourcegraphdirectory.
cp sample.env .env
open .env
- Set the
EXTERNAL_URLvariable to the URL of the instance that you want to run Sourcegraph on. Replaceexternal.example.comwith your own URL.
EXTERNAL_URL=https://external.example.com
- Add the token created in step 5 to the
AUTH0_CLIENT_SECRETfield.
AUTH0_CLIENT_SECRET=<your_personal_access_token>
- Configure Sourcegraph to connect to your code hosting provider by adding your provider's configuration to the
configure.shscript. Sample provider configurations can be found in thedeploy-sourcegraph/configdirectory. For example, openLDAP is included.
vim config/conf-ldap.json
- Run the configuration script to set up Sourcegraph with your configuration:
./configure.sh
- Start the Sourcegraph server:
docker-compose up -d
- You can now access your Sourcegraph instance by visiting the URL you specified in step 7 in your web browser. Please note that for the first use, the server might take some time to start up.
##Conclusion
By following these steps, you can install Sourcegraph on your macOS machine and start using it as a code search and navigation tool. Happy Coding!