Manage env files with 1password for local development

Environment variables

Environment variables are variables that contain information that is used by the operating system and other programs. They are typically used to store configuration data or pass information to programs when launched. Environment variables are usually stored as key-value pairs, with the key representing the variable's name and the value representing the variable's contents.

There are a few different ways to set and use environment variables. One way is to set them in the operating system's environment. This can be done through the command line or a configuration file. For example, on a Unix-based system, you can use the "export" command to set an environment variable like this:

You can also set environment variables for a specific program or script using a configuration file or specifying them on the command line when you launch the program.

To keep environment variables safe, it is important to be mindful of who has access to them and how they are used. For example, you may want to keep sensitive information such as passwords or API keys in environment variables, but you should be careful about sharing these variables with others. One way to share environment variables safely is to use a tool that allows you to store them securely and share them only with trusted parties.

This is how I share environment variables with colleagues and others.

1 Password

1Password is a password manager and security software that helps users generate, store, and manage strong, unique passwords for their online accounts. It also includes features to protect against online threats such as phishing attacks and to help users securely share passwords with others.

With 1Password, users can create a single, secure password to access their online accounts. They can also use the software to generate strong, unique passwords for each account, which helps protect against password reuse and brute-force attacks. 1Password can store passwords, credit card information, and other sensitive data in an encrypted format, so it is safe to use even if the device is lost or stolen.

In addition to its password management features, 1Password also includes tools to help users protect themselves against online threats such as phishing attacks. It can also be used to securely share passwords with others, such as team members or family members, without sharing the actual password.

Overall, 1Password is a useful tool for anyone who wants to improve their online security and manage their passwords more effectively.


Getting started


Change the following script variables according to your situation:

Place the script in the following folder: /usr/local/bin/dotenv-op


Get a document

Save a document

Edit a document

Edit a document directly inside your terminal

This will download the existing document on 1Password and open your favourite editor to edit it.

Compare a document directly inside your terminal.

This will download the existing document on 1Password and compare it with your local version.