Skip to content

Commit efa8899

Browse files
dot files: move ~/.juliarc.jl to ~/.julia/config/startup.jl
also rename `/etc/julia/juliarc.jl` to `/etc/julia/startup.jl`
1 parent 74ec1f9 commit efa8899

19 files changed

+65
-57
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Here is the standard procedure:
235235
2. Start a Julia REPL session. Then issue the following commands:
236236

237237
```julia
238-
using Revise # if you aren't launching it in your .juliarc.jl
238+
using Revise # if you aren't launching it in your `.julia/config/startup.jl`
239239
Revise.track(Base)
240240
```
241241

DISTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ and other environment variables you can pass when calling `make` and
8181
`make install`. See Make.inc for their list. `DESTDIR` can also be used
8282
to force the installation into a temporary directory.
8383

84-
By default, Julia loads `$prefix/etc/julia/juliarc.jl` as an
84+
By default, Julia loads `$prefix/etc/julia/startup.jl` as an
8585
installation-wide initialization file. This file can be used by
8686
distribution managers to set up custom paths or initialization code.
8787
For Linux distribution packages, if `$prefix` is
8888
set to `/usr`, there is no `/usr/etc` to look into. This requires
8989
the path to Julia's private `etc` directory to be changed. This can
9090
be done via the `sysconfdir` make variable when building. Simply
9191
pass `sysconfdir=/etc` to `make` when building and Julia will first
92-
check `/etc/julia/juliarc.jl` before trying
93-
`$prefix/etc/julia/juliarc.jl`.
92+
check `/etc/julia/startup.jl` before trying
93+
`$prefix/etc/julia/startup.jl`.
9494

9595
OS X
9696
----

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ endif
8080
julia-deps: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia/test $(build_defaultpkgdir)
8181
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/deps
8282

83-
julia-base: julia-deps $(build_sysconfdir)/julia/juliarc.jl $(build_man1dir)/julia.1 $(build_datarootdir)/julia/julia-config.jl
83+
julia-base: julia-deps $(build_sysconfdir)/julia/startup.jl $(build_man1dir)/julia.1 $(build_datarootdir)/julia/julia-config.jl
8484
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/base
8585

8686
julia-libccalltest: julia-deps
@@ -157,8 +157,8 @@ $(build_man1dir)/julia.1: $(JULIAHOME)/doc/man/julia.1 | $(build_man1dir)
157157
@mkdir -p $(build_man1dir)
158158
@cp $< $@
159159

160-
$(build_sysconfdir)/julia/juliarc.jl: $(JULIAHOME)/etc/juliarc.jl | $(build_sysconfdir)/julia
161-
@echo Creating usr/etc/julia/juliarc.jl
160+
$(build_sysconfdir)/julia/startup.jl: $(JULIAHOME)/etc/startup.jl | $(build_sysconfdir)/julia
161+
@echo Creating usr/etc/julia/startup.jl
162162
@cp $< $@
163163

164164
$(build_datarootdir)/julia/julia-config.jl : $(JULIAHOME)/contrib/julia-config.jl | $(build_datarootdir)/julia
@@ -426,11 +426,11 @@ ifeq ($(OS), Linux)
426426
# Copy over any bundled ca certs we picked up from the system during buildi
427427
-cp $(build_datarootdir)/julia/cert.pem $(DESTDIR)$(datarootdir)/julia/
428428
endif
429-
# Copy in juliarc.jl files per-platform for binary distributions as well
429+
# Copy in startup.jl files per-platform for binary distributions as well
430430
# Note that we don't install to sysconfdir: we always install to $(DESTDIR)$(prefix)/etc.
431431
# If you want to make a distribution with a hardcoded path, you take care of installation
432432
ifeq ($(OS), Darwin)
433-
-cat $(JULIAHOME)/contrib/mac/juliarc.jl >> $(DESTDIR)$(prefix)/etc/julia/juliarc.jl
433+
-cat $(JULIAHOME)/contrib/mac/startup.jl >> $(DESTDIR)$(prefix)/etc/julia/startup.jl
434434
endif
435435

436436
ifeq ($(OS), WINNT)

NEWS.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ This section lists changes that do not have deprecation warnings.
263263
of the socket. Previously the address of the remote endpoint was being
264264
returned ([#21825]).
265265

266-
* Using `ARGS` within the ~/.juliarc.jl or within a .jl file loaded with `--load` will no
266+
* The `~/.juliarc.jl` file has been moved to `~/.julia/config/startup.jl` and
267+
`/etc/julia/juliarc.jl` file has been renamed to `/etc/julia/startup.jl` ([#26161]).
268+
269+
* Using `ARGS` within `startup.jl` files or within a .jl file loaded with `--load` will no
267270
longer contain the script name as the first argument. Instead, the script name will be
268271
assigned to `PROGRAM_FILE`. ([#22092])
269272

@@ -801,7 +804,7 @@ Deprecated or removed
801804
* Calling `write` on non-isbits arrays is deprecated in favor of explicit loops or
802805
`serialize` ([#6466]).
803806

804-
* The default `juliarc.jl` file on Windows has been removed. Now must explicitly include the
807+
* The default `startup.jl` file on Windows has been removed. Now must explicitly include the
805808
full path if you need access to executables or libraries in the `Sys.BINDIR` directory, e.g.
806809
`joinpath(Sys.BINDIR, "7z.exe")` for `7z.exe` ([#21540]).
807810

README.windows.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The 64-bit (x86_64) binary will only run on 64-bit Windows and will otherwise re
6363

6464
3. Julia's home directory is the location pointed to by the Windows environment
6565
variable `%HOME%`: this directory is for instance where the startup file
66-
`.juliarc.jl` resides. `%HOMEDRIVE%\%HOMEPATH%` is used as a fallback if
66+
`.julia/config/startup.jl` resides. `%HOMEDRIVE%\%HOMEPATH%` is used as a fallback if
6767
`%HOME%` is not defined.
6868

6969
## Source distribution

base/client.jl

+12-12
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ function exec_options(opts)
295295
invokelatest(Main.Distributed.process_opts, opts)
296296
end
297297

298-
# load ~/.juliarc file
299-
startup && load_juliarc()
298+
# load ~/.julia/config/startup.jl file
299+
startup && load_julia_startup()
300300

301301
if repl || is_interactive
302302
# load interactive-only libraries
@@ -345,16 +345,16 @@ function exec_options(opts)
345345
nothing
346346
end
347347

348-
function load_juliarc()
349-
# If the user built us with a specific Base.SYSCONFDIR, check that location first for a juliarc.jl file
348+
function load_julia_startup()
349+
# If the user built us with a specific Base.SYSCONFDIR, check that location first for a startup.jl file
350350
# If it is not found, then continue on to the relative path based on Sys.BINDIR
351-
if !isempty(Base.SYSCONFDIR) && isfile(joinpath(Sys.BINDIR, Base.SYSCONFDIR, "julia", "juliarc.jl"))
352-
include(Main, abspath(Sys.BINDIR, Base.SYSCONFDIR, "julia", "juliarc.jl"))
351+
if !isempty(Base.SYSCONFDIR) && isfile(joinpath(Sys.BINDIR, Base.SYSCONFDIR, "julia", "startup.jl"))
352+
include(Main, abspath(Sys.BINDIR, Base.SYSCONFDIR, "julia", "startup.jl"))
353353
else
354-
include_ifexists(Main, abspath(Sys.BINDIR, "..", "etc", "julia", "juliarc.jl"))
354+
include_ifexists(Main, abspath(Sys.BINDIR, "..", "etc", "julia", "startup.jl"))
355355
end
356-
include_ifexists(Main, abspath(homedir(), ".juliarc.jl"))
357-
nothing
356+
include_ifexists(Main, abspath(homedir(), ".julia", "config", "startup.jl"))
357+
return nothing
358358
end
359359

360360
const repl_hooks = []
@@ -364,8 +364,8 @@ const repl_hooks = []
364364
365365
Register a one-argument function to be called before the REPL interface is initialized in
366366
interactive sessions; this is useful to customize the interface. The argument of `f` is the
367-
REPL object. This function should be called from within the `.juliarc.jl` initialization
368-
file.
367+
REPL object. This function should be called from within the `.julia/config/startup.jl`
368+
initialization file.
369369
"""
370370
atreplinit(f::Function) = (pushfirst!(repl_hooks, f); nothing)
371371

@@ -400,7 +400,7 @@ function run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_fil
400400
active_repl = REPL.LineEditREPL(term, have_color, true)
401401
active_repl.history_file = history_file
402402
end
403-
# Make sure any displays pushed in .juliarc.jl ends up above the
403+
# Make sure any displays pushed in .julia/config/startup.jl ends up above the
404404
# REPLDisplay
405405
pushdisplay(REPL.REPLDisplay(active_repl))
406406
_atreplinit(active_repl)

doc/man/julia.1

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Set location of julia executable
7777

7878
.TP
7979
--startup-file={yes|no}
80-
Load ~/.juliarc.jl
80+
Load ~/.julia/config/startup.jl
8181

8282
.TP
8383
--handle-signals={yes|no}
@@ -189,12 +189,12 @@ Count executions of source lines (omitting setting is equivalent to 'user')
189189
Count bytes allocated by each source line
190190

191191
.SH FILES
192-
.I ~/.juliarc.jl
192+
.I ~/.julia/config/startup.jl
193193
.RS
194194
Per user startup file.
195195
.RE
196196

197-
.I /etc/julia/juliarc.jl
197+
.I /etc/julia/startup.jl
198198
.RS
199199
System-wide startup file.
200200
.RE

doc/src/manual/environment-variables.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ usual way of the operating system, or in a portable way from within Julia.
55
Suppose you want to set the environment variable `JULIA_EDITOR` to
66
`vim`, then either type `ENV["JULIA_EDITOR"] = "vim"` for instance in the REPL
77
to make this change on a case by case basis, or add the same to the user
8-
configuration file `.juliarc.jl` in the user's home directory to have
8+
configuration file `~/.julia/config/startup.jl` in the user's home directory to have
99
a permanent effect. The current value of the same environment variable is
1010
determined by evaluating `ENV["JULIA_EDITOR"]`.
1111

@@ -42,14 +42,14 @@ determines the directory in which Julia initially searches for source files (via
4242
`Base.find_source_file()`).
4343

4444
Likewise, the global variable `Base.SYSCONFDIR` determines a relative path to the
45-
configuration file directory. Then Julia searches for a `juliarc.jl` file at
45+
configuration file directory. Then Julia searches for a `startup.jl` file at
4646

4747
```
48-
$JULIA_BINDIR/$SYSCONFDIR/julia/juliarc.jl
49-
$JULIA_BINDIR/../etc/julia/juliarc.jl
48+
$JULIA_BINDIR/$SYSCONFDIR/julia/startup.jl
49+
$JULIA_BINDIR/../etc/julia/startup.jl
5050
```
5151

52-
by default (via `Base.load_juliarc()`).
52+
by default (via `Base.load_julia_startup()`).
5353

5454
For example, a Linux installation with a Julia executable located at
5555
`/bin/julia`, a `DATAROOTDIR` of `../share`, and a `SYSCONFDIR` of `../etc` will
@@ -62,7 +62,7 @@ have `JULIA_BINDIR` set to `/bin`, a source-file search path of
6262
and a global configuration search path of
6363

6464
```
65-
/etc/julia/juliarc.jl
65+
/etc/julia/startup.jl
6666
```
6767

6868
### `JULIA_LOAD_PATH`

doc/src/manual/getting-started.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ takes the form `[count*][user@]host[:port] [bind_addr[:port]]` . `user` defaults
8080
to 1. The optional `bind-to bind_addr[:port]` specifies the ip-address and port that other workers
8181
should use to connect to this worker.
8282

83-
If you have code that you want executed whenever Julia is run, you can put it in `~/.juliarc.jl`:
83+
If you have code that you want executed whenever Julia is run, you can put it in
84+
`~/.julia/config/startup.jl`:
8485

8586
```
86-
$ echo 'println("Greetings! 你好! 안녕하세요?")' > ~/.juliarc.jl
87+
$ echo 'println("Greetings! 你好! 안녕하세요?")' > ~/.julia/config/startup.jl
8788
$ julia
8889
Greetings! 你好! 안녕하세요?
8990
@@ -100,7 +101,7 @@ julia [switches] -- [programfile] [args...]
100101
101102
-J, --sysimage <file> Start up with the given system image file
102103
-H, --home <dir> Set location of `julia` executable
103-
--startup-file={yes|no} Load ~/.juliarc.jl
104+
--startup-file={yes|no} Load `~/.julia/config/startup.jl`
104105
--handle-signals={yes|no} Enable or disable Julia's default signal handlers
105106
--sysimage-native-code={yes|no}
106107
Use native code from system image if available

doc/src/manual/modules.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ The global variable [`LOAD_PATH`](@ref) contains the directories Julia searches
191191
push!(LOAD_PATH, "/Path/To/My/Module/")
192192
```
193193

194-
Putting this statement in the file `~/.juliarc.jl` will extend [`LOAD_PATH`](@ref) on every Julia startup.
195-
Alternatively, the module load path can be extended by defining the environment variable `JULIA_LOAD_PATH`.
194+
Putting this statement in the file `~/.julia/config/startup.jl` will extend [`LOAD_PATH`](@ref) on
195+
every Julia startup. Alternatively, the module load path can be extended by defining the environment
196+
variable `JULIA_LOAD_PATH`.
196197

197198
### Namespace miscellanea
198199

doc/src/manual/parallel-computing.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ julia> addprocs(2)
221221
Module `Distributed` must be explicitly loaded on the master process before invoking [`addprocs`](@ref).
222222
It is automatically made available on the worker processes.
223223

224-
Note that workers do not run a `.juliarc.jl` startup script, nor do they synchronize their global
225-
state (such as global variables, new method definitions, and loaded modules) with any of the other
226-
running processes.
224+
Note that workers do not run a `~/.julia/config/startup.jl` startup script, nor do they synchronize
225+
their global state (such as global variables, new method definitions, and loaded modules) with any
226+
of the other running processes.
227227

228228
Other types of clusters can be supported by writing your own custom `ClusterManager`, as described
229229
below in the [ClusterManagers](@ref) section.

doc/src/manual/workflow-tips.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ which you can run on startup by issuing the command:
5555
julia -L _init.jl
5656
```
5757
58-
If you further add the following to your `.juliarc.jl` file
58+
If you further add the following to your `~/.julia/config/startup.jl` file
5959
6060
```julia
6161
isfile("_init.jl") && include(joinpath(pwd(), "_init.jl"))

etc/juliarc.jl

-2
This file was deleted.

etc/startup.jl

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file should contain site-specific commands to be executed on Julia startup;
2+
# Users may store their own personal commands in `~/.julia/config/startup.jl`.

src/jloptions.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static const char opts[] =
7878
// startup options
7979
" -J, --sysimage <file> Start up with the given system image file\n"
8080
" -H, --home <dir> Set location of `julia` executable\n"
81-
" --startup-file={yes|no} Load ~/.juliarc.jl\n"
81+
" --startup-file={yes|no} Load `~/.julia/config/startup.jl`\n"
8282
" --handle-signals={yes|no} Enable or disable Julia's default signal handlers\n"
8383
" --sysimage-native-code={yes|no}\n"
8484
" Use native code from system image if available\n"

stdlib/Distributed/src/managers.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ end
296296
297297
Equivalent to `addprocs(Sys.CPU_CORES; kwargs...)`
298298
299-
Note that workers do not run a `.juliarc.jl` startup script, nor do they synchronize their
300-
global state (such as global variables, new method definitions, and loaded modules) with any
299+
Note that workers do not run a `.julia/config/startup.jl` startup script, nor do they synchronize
300+
their global state (such as global variables, new method definitions, and loaded modules) with any
301301
of the other running processes.
302302
"""
303303
addprocs(; kwargs...) = addprocs(Sys.CPU_CORES; kwargs...)

stdlib/Pkg/test/pkg.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,10 @@ temp_pkg_dir() do
563563
mkpath(dirname(test_filename))
564564
write(test_filename, content)
565565

566-
# Make a .juliarc.jl
566+
# Make a ~/.julia/config/startup.jl
567567
home = Pkg.dir(".home")
568568
mkdir(home)
569-
write(joinpath(home, ".juliarc.jl"), "const JULIA_RC_LOADED = true")
569+
write(joinpath(home, ".julia", "config", "startup.jl"), "const JULIA_RC_LOADED = true")
570570

571571
withenv((Sys.iswindows() ? "USERPROFILE" : "HOME") => home) do
572572
code = "redirect_stderr(STDOUT); using Logging; global_logger(SimpleLogger(STDOUT)); import Pkg; Pkg.build(\"$package\")"
@@ -585,7 +585,7 @@ temp_pkg_dir() do
585585
@test contains(msg, "Main.JULIA_RC_LOADED defined false")
586586

587587
# Note: Since both the startup-file and "runtests.jl" are run in the Main
588-
# module any global variables created in the .juliarc.jl can be referenced.
588+
# module any global variables created in the startup file can be referenced.
589589
msg = read(`$(Base.julia_cmd()) --startup-file=yes -e $code`, String)
590590
@test contains(msg, "JULIA_RC_LOADED defined true")
591591
@test contains(msg, "Main.JULIA_RC_LOADED defined true")

stdlib/REPL/docs/src/index.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Meta plus `x` can be written `"\\Mx"`. The values of the custom keymap must be `
191191
that the input should be ignored) or functions that accept the signature `(PromptState, AbstractREPL, Char)`.
192192
The `REPL.setup_interface` function must be called before the REPL is initialized, by registering
193193
the operation with [`atreplinit`](@ref) . For example, to bind the up and down arrow keys to move through
194-
history without prefix search, one could put the following code in `.juliarc.jl`:
194+
history without prefix search, one could put the following code in `~/.julia/config/startup.jl`:
195195

196196
```julia
197197
import REPL
@@ -324,7 +324,7 @@ fields if the function is type stable.
324324

325325
The colors used by Julia and the REPL can be customized, as well. To change the
326326
color of the Julia prompt you can add something like the following to your
327-
`.juliarc.jl` file, which is to be placed inside your home directory:
327+
`~/.julia/config/startup.jl` file, which is to be placed inside your home directory:
328328

329329
```julia
330330
function customize_colors(repl)
@@ -345,7 +345,7 @@ latter two, be sure that the `envcolors` field is also set to false.
345345

346346
It is also possible to apply boldface formatting by using
347347
`Base.text_colors[:bold]` as a color. For instance, to print answers in
348-
boldface font, one can use the following as a `.juliarc.jl`:
348+
boldface font, one can use the following as a `~/.julia/config/startup.jl`:
349349

350350
```julia
351351
function customize_colors(repl)
@@ -358,7 +358,8 @@ atreplinit(customize_colors)
358358

359359
You can also customize the color used to render warning and informational messages by
360360
setting the appropriate environment variables. For instance, to render error, warning, and informational
361-
messages respectively in magenta, yellow, and cyan you can add the following to your `.juliarc.jl` file:
361+
messages respectively in magenta, yellow, and cyan you can add the following to your
362+
`~/.julia/config/startup.jl` file:
362363

363364
```julia
364365
ENV["JULIA_ERROR_COLOR"] = :magenta

test/cmdlineargs.jl

+5-3
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
279279
write(testfile, """
280280
println(ARGS)
281281
""")
282-
cp(testfile, joinpath(dir, ".juliarc.jl"))
282+
mkpath(joinpath(dir, ".julia", "config"))
283+
cp(testfile, joinpath(dir, ".julia", "config", "startup.jl"))
283284

284285
withenv((Sys.iswindows() ? "USERPROFILE" : "HOME") => dir) do
285286
output = "[\"foo\", \"-bar\", \"--baz\"]"
@@ -304,7 +305,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
304305
mktempdir() do dir
305306
a = joinpath(dir, "a.jl")
306307
b = joinpath(dir, "b.jl")
307-
c = joinpath(dir, ".juliarc.jl")
308+
c = joinpath(dir, ".julia", "config", "startup.jl")
308309

309310
write(a, """
310311
println(@__FILE__)
@@ -315,6 +316,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
315316
println(@__FILE__)
316317
println(PROGRAM_FILE)
317318
""")
319+
mkpath(dirname(c))
318320
cp(b, c)
319321

320322
readsplit(cmd) = split(readchomp(cmd), '\n')
@@ -416,7 +418,7 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes`
416418
# --startup-file
417419
let JL_OPTIONS_STARTUPFILE_ON = 1,
418420
JL_OPTIONS_STARTUPFILE_OFF = 2
419-
# `HOME=$tmpdir` to avoid errors in the user .juliarc.jl, which hangs the tests. Issue #17642
421+
# `HOME=$tmpdir` to avoid errors in the user startup.jl, which hangs the tests. Issue #17642
420422
mktempdir() do tmpdir
421423
withenv("HOME"=>tmpdir) do
422424
@test parse(Int,readchomp(`$exename -E "Base.JLOptions().startupfile" --startup-file=yes`)) == JL_OPTIONS_STARTUPFILE_ON

0 commit comments

Comments
 (0)