Skip to content
Newer
Older
100644 178 lines (124 sloc) 4.58 KB
1a66463 @samoht Update README
samoht authored
1 # OPAM - A package manager for OCaml
3656b4d @lefessan First commit
lefessan authored
2
415544e @samoht Update README.md
samoht authored
3 OPAM is a source-based package manager for OCaml. It supports multiple simultaneous
4 compiler installations, flexible package constraints, and a Git-friendly development
5 workflow.
33d1c10 @samoht Update README.md
samoht authored
6
2ee2d70 @samoht Update README.md
samoht authored
7 ### Prerequisites:
f247b50 @samoht Update README
samoht authored
8
07bf28d @samoht Update prerequesites
samoht authored
9 * ocaml (>= 3.12.1)
45651c3 @samoht Remove curl -J option as it is not available on old curl
samoht authored
10 * curl or wget
33d1c10 @samoht Update README.md
samoht authored
11 * git (optional)
12 * rsync (optional)
a7ec30c @tuong At upload time, the archive is sent everytime now.
tuong authored
13
21ecb3d @samoht Add quick install instruction
samoht authored
14 ### Quick install
15
6da9ba3 @avsm update README
avsm authored
16 To download, compile and install OPAM, you can simply run:
21ecb3d @samoht Add quick install instruction
samoht authored
17
18 ```
171e275 @samoht Update README
samoht authored
19 $ wget https://raw.github.com/OCamlPro/opam/master/shell/install.sh && sh ./install.sh
21ecb3d @samoht Add quick install instruction
samoht authored
20 ```
21
c5b08a5 @samoht Update README.md
samoht authored
22 ### Compiling OPAM
84f4fc3 @samoht Update README.md
samoht authored
23
29a6804 @samoht Add install instructions
samoht authored
24 To compile `opam`, simply run:
f247b50 @samoht Update README
samoht authored
25
7600e90 @samoht Update README
samoht authored
26 ```
6da9ba3 @avsm update README
avsm authored
27 $ ./configure
28 # (or ./configure --prefix=$HOME if you want to install under your $HOME)
17e1839 @samoht Update README.md
samoht authored
29 $ make
7600e90 @samoht Update README
samoht authored
30 ```
3656b4d @lefessan First commit
lefessan authored
31
6da9ba3 @avsm update README
avsm authored
32 This will fetch the archives if they are not already downloaded and then build
33 OPAM. If you just want to get the necessary dependencies without compiling the
34 project, run `make clone`.
fb6191e @samoht Update README.md
samoht authored
35
29a6804 @samoht Add install instructions
samoht authored
36 ### Installing OPAM
37
e82dec8 Updated README.md, deleting un-needed dependency to ocamlfind
Vincent Bernardoff authored
38 To install opam simply run:
29a6804 @samoht Add install instructions
samoht authored
39
40 ```
e82dec8 Updated README.md, deleting un-needed dependency to ocamlfind
Vincent Bernardoff authored
41 $ make install
29a6804 @samoht Add install instructions
samoht authored
42 ```
43
e82dec8 Updated README.md, deleting un-needed dependency to ocamlfind
Vincent Bernardoff authored
44 or
29a6804 @samoht Add install instructions
samoht authored
45
46 ```
e82dec8 Updated README.md, deleting un-needed dependency to ocamlfind
Vincent Bernardoff authored
47 $ sudo make install
29a6804 @samoht Add install instructions
samoht authored
48 ```
49
e82dec8 Updated README.md, deleting un-needed dependency to ocamlfind
Vincent Bernardoff authored
50 if you need root privileges.
51
6da9ba3 @avsm update README
avsm authored
52 This way, OPAM binaries will be installed in `$prefix/bin`, where
53 `prefix` can been specified during the `./configure` phase.
d6ceb9f Modified README.md to reflect the changes in the Makefile
Vincent Bernardoff authored
54
c5b08a5 @samoht Update README.md
samoht authored
55 ### Using opam
7f510c5 @samoht Few makefile tweaks
samoht authored
56
c5b08a5 @samoht Update README.md
samoht authored
57 All of the OPAM state is held in the `~\.opam` directory in your home
6da9ba3 @avsm update README
avsm authored
58 directory, including compiler installations. You should never need to switch to
59 a root user to install packages. Package listings are obtained through remote
60 sources.
7f510c5 @samoht Few makefile tweaks
samoht authored
61
62 ```
17e1839 @samoht Update README.md
samoht authored
63 $ opam init
415544e @samoht Update README.md
samoht authored
64 $ eval `opam config env`
7600e90 @samoht Update README
samoht authored
65 ```
66
6da9ba3 @avsm update README
avsm authored
67 The first command creates `~\.opam` and sets up `opam.ocamlpro.com` as the
68 default repository. The second command updates your local environment to use
69 the packages installed by OPAM. You should add the `eval` line to your
70 `~/.profile` so you don't forget to run it before using OCaml.
7600e90 @samoht Update README
samoht authored
71
72 ```
17e1839 @samoht Update README.md
samoht authored
73 $ opam list
7f510c5 @samoht Few makefile tweaks
samoht authored
74 ```
e04535c @samoht Add API documentation
samoht authored
75
6da9ba3 @avsm update README
avsm authored
76 As expected, this command lists all the available packages. We can now install
77 some packages (for instance `lwt`):
e04535c @samoht Add API documentation
samoht authored
78
c5b08a5 @samoht Update README.md
samoht authored
79 ```
17e1839 @samoht Update README.md
samoht authored
80 $ opam install lwt
81 ```
82
83 OPAM is able to track optional dependencies. This mean that installing an
84 optional dependency of a package will recompile the package and all its
85 forward dependencies. For instance:
86
87 ```
b054136 @avsm fix typo in README
avsm authored
88 $ opam install react
17e1839 @samoht Update README.md
samoht authored
89 ```
90
6da9ba3 @avsm update README
avsm authored
91 will install `react` and also recompile `lwt` with the right `./configure`
92 options to support `react`, and also all the packages which further depend on
93 `lwt`.
17e1839 @samoht Update README.md
samoht authored
94
95
96 ### Installing on other OCaml compiler
97
6da9ba3 @avsm update README
avsm authored
98 OPAM also manages meta-data about OCaml compilers. So in order to install a new
99 version of the compiler, you can run:
17e1839 @samoht Update README.md
samoht authored
100
101 ```
6da9ba3 @avsm update README
avsm authored
102 $ opam switch 4.00.1
415544e @samoht Update README.md
samoht authored
103 $ eval `opam config env`
17e1839 @samoht Update README.md
samoht authored
104 ```
105
6da9ba3 @avsm update README
avsm authored
106 The first command will download and install ocaml-4.00.1, and the second
107 command will update the environment variables. You can then install packages --
108 they will be installed on a different under `~/.opam/4.00.1`.
17e1839 @samoht Update README.md
samoht authored
109
6da9ba3 @avsm update README
avsm authored
110 In order to return to the system-wide OCaml installation, simply run:
17e1839 @samoht Update README.md
samoht authored
111
112 ```
113 $ opam switch system
415544e @samoht Update README.md
samoht authored
114 $ eval `opam config env`
c5b08a5 @samoht Update README.md
samoht authored
115 ```
7600e90 @samoht Update README
samoht authored
116
415544e @samoht Update README.md
samoht authored
117 You can use `opam switch list` to display the list of available compilers.
17e1839 @samoht Update README.md
samoht authored
118
119 ### Version pinning
120
121 ```
122 $ opam pin <package> </local/path>
123 ```
124
6da9ba3 @avsm update README
avsm authored
125 This command will use the content of `</local/path>` to compile `<package>`.
126 This means that the next time you will do `opam install <package>`, the
127 compilation process will be using a mirror of `</local/path>` instead of
128 downloading the archive. This also means that any modification to
129 `</local/path>` will be picked up by `opam update`, and thus `opam upgrade`
17e1839 @samoht Update README.md
samoht authored
130 will recompile `<package>` (and its forward dependencies) if needed.
131
132 To unpin a package, simply run:
133
134 ```
135 $ opam pin <package> none
136 ```
137
138 You can also pin a package to a specific version: `opam pin <package> <version>`
ac523f2 @samoht Update README
samoht authored
139 or to a git repository: `opam pin <package> </remote/path/to/git>` or
140 `opam pin <package> </local/path/to/git> -k git`.
17e1839 @samoht Update README.md
samoht authored
141
142 ### Repositories
143
6da9ba3 @avsm update README
avsm authored
144 OPAM supports multiple package repositories, for example for development
145 packages.
17e1839 @samoht Update README.md
samoht authored
146
147 ```
415544e @samoht Update README.md
samoht authored
148 $ opam remote list
17e1839 @samoht Update README.md
samoht authored
149 ```
150
171e275 @samoht Update README
samoht authored
151 ### Uninstall
152
153 To uninstall OPAM, use:
154
155 ```
156 $ make uninstall
157 ```
158
5ca91df @samoht Add auto-completion scripts
samoht authored
159 ### Auto-completion
160
161 `shell/` contains shell-scripts to add auto-completion to OPAM. The script is not
162 installed by default, so to activate the mode you can either:
163
164 * move it at the right location (depending on your OS, for instance
165 `/etc/auto-complete.d/opam` on Debian)
166
167 * copy it somewhere in you path and source it in your `.profile`.
17e1839 @samoht Update README.md
samoht authored
168
7600e90 @samoht Update README
samoht authored
169 ## Documentation
e04535c @samoht Add API documentation
samoht authored
170
171e275 @samoht Update README
samoht authored
171 * The main documentation entry point to OPAM is the user manual, available using `opam --help`. To see the
172 help for a specific command, use `opam <command> --help`.
fa47fcd @samoht Fix typo in README
samoht authored
173 * The API documentation is available in `doc/html/`.
ac523f2 @samoht Update README
samoht authored
174 * A collection of tutorials are available on the [OPAM wiki](https://github.com/OCamlPro/opam/wiki/_pages).
fa47fcd @samoht Fix typo in README
samoht authored
175 They are also available on http://opam.ocamlpro.com/ (in the "Documentation" menu), or in PDF
176 in `doc/tutorials`.
ac523f2 @samoht Update README
samoht authored
177 * The developer manual is available in `doc/dev-manual/`.
Something went wrong with that request. Please try again.