sharete
sharete

Reputation: 41

Create YAML file in terminal - MacOS

Either I'm too stupid or I can't find the right command.

How can I create a simple YAML file using the ZSH terminal?

Upvotes: 2

Views: 43492

Answers (3)

Quinten
Quinten

Reputation: 41357

First you should create a conda environment in the folder you want to have like this (I call the environment "project_name"):

conda create -n project_name python=3.9

After that you should activate your environment in the terminal like this:

conda activate project_name

Finally, you could use this command to export a yaml file. I call it "environment.yaml" like this:

conda env export > environment.yaml

Then you can go to your folder in finder and check the file. The output may look like this:

name: project_name
channels:
  - defaults
dependencies:
  - ca-certificates=2023.01.10=hecd8cb5_0
  - libcxx=14.0.6=h9765a3e_0
  - libffi=3.4.4=hecd8cb5_0
  - ncurses=6.4=hcec6c5f_0
  - openssl=1.1.1t=hca72f7f_0
  - pip=23.0.1=py39hecd8cb5_0
  - python=3.9.16=h218abb5_2
  - readline=8.2=hca72f7f_0
  - setuptools=66.0.0=py39hecd8cb5_0
  - sqlite=3.41.2=h6c40b1e_0
  - tk=8.6.12=h5d9f67b_0
  - tzdata=2023c=h04d1e81_0
  - wheel=0.38.4=py39hecd8cb5_0
  - xz=5.4.2=h6c40b1e_0
  - zlib=1.2.13=h4dc903c_0
prefix: /Users/quinten/opt/miniconda3/envs/project_name

Upvotes: 0

Milos Zivkovic
Milos Zivkovic

Reputation: 117

YAML is just a format so you can create any text file and just add an .yml or .yaml extension.

Command for creating files in zsh is touch

touch test.yaml

What people usually do is to just open a terminal text editor like nano or vim add the content and save as *.yml or *.yaml

Upvotes: 6

You can create yml file like these commands

echo "basic" > basic.yml or touch simple.yml

Upvotes: 6

Related Questions